[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Can be coded without loop?



PureBytes Links

Trading Reference Links

Hi

I wanted to plot some horizontal lines extending from successive hi and lo
pivot points. The code below illustrates the intention but does not work as
I guess IIF is evaluating the argument arrays prior to execution.

Wondering if there is a way to do this without looping? Basically need
method to propagate same value thru array until condition changes then
propagate next value...

John

8<
/* draw horizontal lines at hi & lo pivot points*/
//P = ParamField("Price field",-1);
p=Close;
Hipiv = IIf(P<Ref(P,-1) AND (Ref(P,-1)>Ref(P,-2)),1,0);
Lopiv = IIf(P>Ref(P,-1) AND (Ref(P,-1)<Ref(P,-2)),1,0);
Hline=0;
hline=IIf(hipiv==1,Ref(p,-1),Ref(hline,-1));
Plot (C,"close",colorBlack);
Plot (Hline,"hline",colorRed);
8<
/