Date change to reset variable

Questions about MultiCharts and user contributed studies.
kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Date change to reset variable

Postby kinwai » 12 Oct 2019

I use date > date[1] to reset variable after date change.

Eg

Code: Select all

If date > date[1] then var1 = 0;

Found it doesn’t work when I use tick data, the var1 reset to 0 for all tick within the same bar (on my case 1 min per bar), for my logic, I only want to reset var1 to 0 at first tick only. The var1 has already declared as InsistBarExist.

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: Date change to reset variable

Postby Smoky » 13 Oct 2019

Code: Select all

Raison_Calcul=GetAppInfo(aiCalcReason); // DETECT ORDER EVENT AND TRUE TICK

//FIRST TICK OF THE DAY
if RealTicks=False and date <> date[1] then
begin

//FORCE DETECTION on last bar
if LastBarOnChart_s=True and Raison_Calcul=0 then
begin
RealTicks=True; //first tick of the day
end;
end;
maybe try this ...


Return to “MultiCharts”