I've got a very simple indicator but can't get proper afl code.

I want to plot an indicator equal to MA(C, 50) on day1 - let's say 20
$. For the following 2 days it has to be the same - 20$.
On day 4 it is equal to MA(C, 50) again - let's say 30$ - and remain 
at 30$ for the following 2 days again.
Its shape would then be similar to a staircase.

In short the indicator should be equal to MA(C, 50) every four days 
and be the same for the remaining 3 days.

I tried to code it as follow but it doesn't work due to the IIF logic:

MyIndicator = IIf(BarsSince(MA(C, 50) != Ref(MA(C, 50), -1)) > 3, MA
(C, 50), Ref(Ma(C, 50), -1));

Anyone can help?

regards,

paolo


Reply via email to