Lol !! I tried to build a custom indicator . I want to retrieve the bar's number as soon as two moving average are crossing , or the index number at the point of intersection . I wished to spy the value by using "filter = 1 ;" As soon as I have caught this number I can to compute a second number 80 bar ago . With that I have a time interval and I can plot this interval at the screen .
Here is my code Curve1= 0 ; Curve2 = 0; Curve1 = Cross(WMA(C,150),MA(C,150)); Curve2= Ref(Cross(WMA(C,150),MA(C,150)),80); a = 0 ; b = 0 ; a = ValueWhen(Curve1,MA(C,150)); b= ValueWhen(Curve2,MA(C,150)); Refindex1 = Curve1[0];//Here I trie to catch the bar' number without success Refindex2 = Curve2[0]; numdesbarres =BarIndex(); Plot(IIf(BarIndex() >= Refindex2 AND BarIndex() <= Ref index1,a,Null),"TEST",colorBlack,1); Plot(IIf(BarIndex() >= Refindex2 AND BarIndex() <= Refindex1,b,Null),"TEST",colorRed,1); Filter = 1; AddColumn(numdesbarres,"bar's number"); AddColumn(Refindex1,"index number"); AddColumn(Refindex2,"index number 80 bars ago");
