You 're right razzbarry12000 , I don't need a loop . And thanks for the triks int(barindex()) ; i would not found this alone ...
In fact my purpose is to draw automatically a kind of support as soon as 2 MA are crossing .. Something like this but there is another bug ... aire1 = WMA(C,150); aire2 = MA(C,50); aire3 = aire1 / aire2 ; Croisement = 0 ; bi = BarIndex(); beforebar =0 ; barnum = 0; barvalue=0 ; Croisement = IIf(aire3 >= 0.99 AND aire3 <= 1.00, 1 ,2); //ugly !But I don't know how to do ... barnum = IIf(Croisement == 1,int(bi),False); beforebar = IIf(Croisement == 1,int(bi) -80,False); //barnum = IIf( Cross(MA(C,50),WMA(C,150)),int(bi),False); /// this line don't walk //beforebar = IIf(Cross(MA(C,50),WMA(C,150)),int(bi) -80,False); // this line don't walk barvalue = ValueWhen(Cross(MA(C,50),WMA(C,150)),WMA(C,150)); Plot(IIf(BarIndex() >= beforebar AND BarIndex() <= barnum ,barvalue ,Null),"TEST",colorBlack,1); Filter =1; AddColumn(bi,"bar's number"); AddColumn(aire1,"aire1",1.2); AddColumn(aire2,"aire2",1.2); AddColumn(aire3,"aire3",1.2); // value of wma / ma AddColumn(Croisement,"croisement"); // 1 or 2 when statement is true,else 0 AddColumn(IIf(Croisement == 1, int(bi),False), "barnum"); // shows the bar where true AddColumn(beforebar,"before bar"); AddColumn(barvalue,"value's bar");
