Help with referencing previous indicator values on MTF sigs

Questions about MultiCharts and user contributed studies.
Chillie
Posts: 7
Joined: 01 Oct 2010

Help with referencing previous indicator values on MTF sigs

Postby Chillie » 07 Nov 2010

Hi

I have written a MTF signal with daily and 60 min data.

I have defined the trend from the daily chart as:

if (DayEma[0] > DayEma[1]) then
trend = 1
else if (DayEma[0] < DayEma[1]) then
trend = -1
else trend = 0;

However, this only works on the first bar of the new day, all other times the DayEma[0] = DayEma[1].

Is there a way to reference the previous day's data without having to resort to looking at session times?

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Help with referencing previous indicator values on MTF s

Postby Dave Masalov » 08 Nov 2010

Dear Chillie,

You should add a condition like:

var: prevDayEma(0);
if date <> date[1] then
prevDayEma = DayEma[1];

And then make a comparison with this variable.

Chillie
Posts: 7
Joined: 01 Oct 2010

Re: Help with referencing previous indicator values on MTF s

Postby Chillie » 09 Nov 2010

Thanks Dave

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Help with referencing previous indicator values on MTF s

Postby Dave Masalov » 09 Nov 2010

Dear Chillie,

You are welcome.


Return to “MultiCharts”