Using IntraBarPersist

Questions about MultiCharts and user contributed studies.
User avatar
danilo
Posts: 170
Joined: 02 Jan 2007
Location: Italy
Has thanked: 4 times
Been thanked: 9 times

Using IntraBarPersist

Postby danilo » 19 Feb 2008

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

itai007
Posts: 69
Joined: 14 Jun 2007

have posted several posts on this issue

Postby itai007 » 19 Feb 2008

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

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Using IntraBarPersist

Postby TJ » 19 Feb 2008

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
because as soon as lastTime <> Time, you reset intrabarcount to 0.

User avatar
danilo
Posts: 170
Joined: 02 Jan 2007
Location: Italy
Has thanked: 4 times
Been thanked: 9 times

Postby danilo » 19 Feb 2008

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 !

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 20 Feb 2008

IntraBarPersist attribute works, but your question is not clear for us.
Could you specify?

User avatar
danilo
Posts: 170
Joined: 02 Jan 2007
Location: Italy
Has thanked: 4 times
Been thanked: 9 times

Postby danilo » 20 Feb 2008

Andrew,

the IntraBarPersist works properly, It was a my mistake don't have specified as IntraBarPersist all the involved variables.

Regards

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 21 Feb 2008

Fine!


Return to “MultiCharts”