is the word "IntraBarPersist" supported ?
I have tested this piece of code:
-------------------------------------------------------------------
vars: IntraBarPersist intraBarcount(0), lastTime(0);
if (Date <> Date[1]) and (lastTime <> Time) then begin
lastTime = Time;
intraBarcount = 0;
end;
if (lastTime = Time) then intraBarcount = intraBarcount + 1;
--------------------------------------------------------------------
but the variable intraBarcount is never incremented
Using IntraBarPersist
have posted several posts on this issue
search my user name and youll find all of them with the support I got ...
I still find using this challenging .. especially for my intrabar strategies ..
good luck
I still find using this challenging .. especially for my intrabar strategies ..
good luck
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: Using IntraBarPersist
because as soon as lastTime <> Time, you reset intrabarcount to 0.is the word "IntraBarPersist" supported ?
I have tested this piece of code:
-------------------------------------------------------------------
vars: IntraBarPersist intraBarcount(0), lastTime(0);
if (Date <> Date[1]) and (lastTime <> Time) then begin
lastTime = Time;
intraBarcount = 0;
end;
if (lastTime = Time) then intraBarcount = intraBarcount + 1;
--------------------------------------------------------------------
but the variable intraBarcount is never incremented
Actually the correct piece of code is:
vars: barcount(0), lastTime(0), IntraBarPersist count(0), IntraBarPersist intraBarcount(0);
// (A)
if (Date <> Date[1]) and (lastTime <> Time) then begin
count = 0;
lastTime = Time;
barcount = 0;
intraBarcount = 0;
end;
// (B)
if (lastTime <> Time) then begin
barcount = barcount + 1;
lastTime = Time;
intraBarcount = 0;
end;
// (C)
if (lastTime = Time) then intraBarcount = intraBarcount + 1;
--------------------------------------------------------------
The Part (A) reset all variables at the start of each day and time.
The Part (B) is execute at each change of time frames ad increment the bar counter set the time frame variable and reset the intrabar counter, the problem is that since lastTime is not IntraBarPersist , the Part (B) is excetute at every tick since the value of lastTime is update only at the end of Bar. Making also the variable lastTime IntraBarPersist works !
vars: barcount(0), lastTime(0), IntraBarPersist count(0), IntraBarPersist intraBarcount(0);
// (A)
if (Date <> Date[1]) and (lastTime <> Time) then begin
count = 0;
lastTime = Time;
barcount = 0;
intraBarcount = 0;
end;
// (B)
if (lastTime <> Time) then begin
barcount = barcount + 1;
lastTime = Time;
intraBarcount = 0;
end;
// (C)
if (lastTime = Time) then intraBarcount = intraBarcount + 1;
--------------------------------------------------------------
The Part (A) reset all variables at the start of each day and time.
The Part (B) is execute at each change of time frames ad increment the bar counter set the time frame variable and reset the intrabar counter, the problem is that since lastTime is not IntraBarPersist , the Part (B) is excetute at every tick since the value of lastTime is update only at the end of Bar. Making also the variable lastTime IntraBarPersist works !
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact: