The problem is that the Price parameter passed to the function is an array, since ValueWhen returns an array, and that makes HLow an array and you can't test arrays in an "if" statement.
GP --- In [email protected], "wongloktim" <[EMAIL PROTECTED]> wrote: > > Please Help > > I found this cause Do Loop problem:{for(i=bars+1; i<BarCount;i++)} > > //////////////////////////////////////////////////////////////////// > SetChartOptions(0,chartShowArrows|chartShowDates); > _N(Title = FullName()+StrFormat(" {{NAME}} - {{INTERVAL}} {{DATE}} > Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, > SelectedValue( ROC( C, 1 ) ) )); > Plot( C,"Price",colorBlack,64 ); > > function HigherLow(Bars,Price) > { > HLow=Price; > HLowArr=Null; > if(Bars>0) > { > for(i=bars+1; i<BarCount;i++) > { > if(Low[i] >= HLow) > { > HLow=Low[i]; > HLowArr[i]=HLow; > } > else > HlowArr[i]=HLow; > } > } > return HlowArr; > } > Start = SelectedValue(BarIndex()); > Price=ValueWhen(BarIndex()==start,L,1); > Test=HigherLow(Start,Price); > Plot(IIf(start,Test,Null),"StopLoss",colorRed,4); > > /////////////////////////////////////////////////////////// >
