Hi, I am a beginner in programming with AFL and I am blocked
with the following problem :
I would like to know the previous cycle of bars since a MA crossing.
And establish an array with all those periods in the chart.
Exemple : EMA 20 and EMA 60 crossing.
The active cycle is easy :
EMA20 == EMA(C,20);
EMA60 == EMA(C,60);
X=Barssince(EMA20>EMA60);
Y=Barssince(EMA20<EMA60);
So I know always the actual period after the last crossing.
The other one is reset to 0
But I would like to keep the value of the previous one
and to get the array of all those periods in the chart.
How can I achieve this ?
Thanks for answers
with the following problem :
I would like to know the previous cycle of bars since a MA crossing.
And establish an array with all those periods in the chart.
Exemple : EMA 20 and EMA 60 crossing.
The active cycle is easy :
EMA20 == EMA(C,20);
EMA60 == EMA(C,60);
X=Barssince(EMA20>EMA60);
Y=Barssince(EMA20<EMA60);
So I know always the actual period after the last crossing.
The other one is reset to 0
But I would like to keep the value of the previous one
and to get the array of all those periods in the chart.
How can I achieve this ?
Thanks for answers