/*[[ Name := Bunnycross2 Author := Amir Separate Window := Yes First Color := White First Draw Type := Line First Symbol := 217 Use Second Data := Yes Second Color := Yellow Second Draw Type := Line Second Symbol := 218 ]]*/ Inputs: BWMA1(100),BWMA2(200),BarsCount(500); Variable : shift(0),bars_(0); Variable: smconst1(0),smconst2(0),prev1(0),prev2(0),MA1(0),MA2(0),value1(0),value2(0); SetLoopCount(0); if BarsCount > 0 then { if BarsCount > Bars then {bars_ = Bars;} else {bars_ = BarsCount;} } else {bars_ = Bars;}; // loop from first bar to current bar (with shift=0) For shift=Bars-1 Downto 0 Begin value1 = iMA(BWMA1,MODE_WMA,shift); value2 = iMA(BWMA2,MODE_WMA,shift); SetIndexValue(shift, value1); SetIndexValue2(shift, value2); End;