Yes, that's it...thanks for the smart hint p
--- In [email protected], "Mike" <sfclimb...@...> wrote: > > Is this what you want? > > Series1 = MA(Close, 50); > Series2 = ValueWhen(BarIndex()%3 == 0, Series1); > Plot(Series1, "Smooth", colorRed); > Plot(Series2, "Steps", colorBlue); > > The above will give you a series like the following: > > 20,20,20,30,30,30,... > > Mike > > --- In [email protected], "Paolo Cavatore" <pcavatore@> > wrote: > > > > 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 > > >
