# [PL/EL] How to skip the first tick of the day?

Questions about MultiCharts and user contributed studies.
2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

### [PL/EL] How to skip the first tick of the day?

I have a question about writing EL

In most cases, the first tick of the day involves a big gap change.

Sometimes I would like to skip it for the calculation of a signal.

Is it possible to skip the first tick of the day?

HR

TJ
Posts: 7456
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 999 times
Been thanked: 2136 times
what do you mean by skip the first tick in your calculation?

these might help:

the first tick of a bar is
a) open
b) barstatus = 0

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times
Literally the first tick of the day.

When the market opens at 09:00:00 AM, MC will receive ticks. Among them I would like to exclude the first tick (only one per day) in the calculation of EL.

Thanks TJ and look forward to more help.

janus
Posts: 802
Joined: 25 May 2009
Has thanked: 46 times
Been thanked: 94 times
This might help..

variables:
mydate(0), skip(False);

skip = False;
if Date <> mydate then begin
mydate = Date;
skip = true;
end;

if not skip then begin
end;

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times
<Date>, <Time>, <Close>, <Volume>
2009-06-13,09:00,180.10,620
2009-06-13,09:01,180.15,55
2009-06-13,09:01,180.15,36
2009-06-13,09:01,180.15,19
2009-06-13,09:01,180.20,88
2009-06-13,09:02,180.10,42
2009-06-13,09:06,180.10,34
2009-06-13,09:07,180.10,42
2009-06-13,09:07,180.15,27
2009-06-13,09:07,180.15,15
--------------------------------- first 10 ticks
2009-06-13,09:08,180.15,55
2009-06-13,09:17,180.15,30
2009-06-13,09:17,180.20,23
2009-06-13,09:17,180.20,36
2009-06-13,09:18,180.25,20
2009-06-13,09:18,180.20,11
2009-06-13,09:18,180.25,20
2009-06-13,09:18,180.20,17
2009-06-13,09:19,180.25,44
2009-06-13,09:19,180.25,17
-------------------------------- second 10 ticks
2009-06-13,09:19,180.25,26
2009-06-13,09:19,180.20,32
2009-06-13,09:19,180.20,85
2009-06-13,09:19,180.15,26
2009-06-13,09:19,180.15,26

The first bold line is the first tick of the day.

I need to plot a 10-tick chart(with TradeVolume on) and ceate an indicator and a signal to calculate the accumulated up volumes and down volumes. The only limitation is to exclude the first line, the first tick of the day, for calculation.

I tried a bit, but failed to filter the first tick of the day.

Can someone write a code for this please?

Thank you.

HR

ABC
Posts: 642
Joined: 16 Dec 2006
Has thanked: 120 times
Been thanked: 362 times
Contact:
2haerim,

from what I see you'll have to use intrabarpersist flags, to ensure that they will be activated on the very first tick and not on bar close. So with little modifications the code provided by janus should do the trick.

Regards,
ABC

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times
variables: intrabarpersist mydate(0), intrabarpersist skip(False);
variables: intrabarpersist uv(0), intrabarpersist dv(0);

skip = False;
if Date <> mydate then begin
mydate = Date;
uv = 0;
dv = 0;
skip = true;
end;

if not skip then begin
uv += UpTicks;
dv += DownTicks;
plot1(uv, "uv");
plot2(dv, "dv");
end;

Will this indicator plot accumulated upvol/downvol excluding the very first tick of the day?

I appied to a 10 tick chart, but I am not confident if it is right or not?

Please some one try and verify this works.

HR

SUPER
Posts: 638
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 81 times
2hareim,

Will a counter do the trick?

Regards
Super

variables: intrabarpersist skip(0);
variables: intrabarpersist uv(0), intrabarpersist dv(0);

if Date<>Date[1] then skip=0;

skip = skip + 1;

if skip >=1 then begin
uv += UpTicks;
dv += DownTicks;
plot1(uv, "uv");
plot2(dv, "dv");
end;

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times
Thank you SUPER,

Some questions.

[1] Will this code work for a signal too if I replace the plot statemenst with buy/sell statement as shown below? Do I need to use IOG?

Code: Select all

```variables: intrabarpersist skip(0); variables: intrabarpersist uv(0), intrabarpersist dv(0); if Date<>Date[1] then skip=0; skip = skip + 1; if skip >=1 then begin uv += UpTicks; dv += DownTicks; buy at market; end;```
[2] Will these code using IntrabarPersist and/or IntrabarOrderGeneraton work the same for history data?

HR

SUPER
Posts: 638
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 81 times
2haerim,

It should work similar to your indicator study if you use IOG in your Strategy.

It should work on historical data, but you have to remember that we do not have tick level resolution available on historical bars so the trades may not match real time trading results.

Regards
Super