//---- input parameters double Lots=0.1; int FastMAPeriod=3; int FastMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA int FastMAPrice=0; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted int SlowMAPeriod=6; int SlowMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA int SlowMAPrice=0; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted int BuyTicket,SellTicket; int StLevel2; double slts,tpts; void SetArrow(datetime _time,double _price,string _Description ,int _arrowType, color _arrowColor) { bool res; ObjectCreate(_Description,OBJ_ARROW,0,_time,_price); ObjectSet(_Description,OBJPROP_ARROWCODE,_arrowType); ObjectSet(_Description,OBJPROP_COLOR,_arrowColor); } int start(){ ObjectsDeleteAll(0,OBJ_ARROW); int startBar = Bars-100; double fast_ma1=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,startBar+1); double slow_ma1=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,startBar+1); double fast_ma2=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,startBar+2); double slow_ma2=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,startBar+2); bool prevState = fast_ma2>slow_ma2; bool State = prevState; int nCross1=0; int nCross2=0; for(int nBar=startBar;nBar>0;nBar--) { fast_ma1=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,nBar+1); slow_ma1=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,nBar+1); fast_ma2=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,nBar+2); slow_ma2=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,nBar+2); bool cond = false; if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)){ SetArrow(Time[nBar],fast_ma1,nBar+">",1,Green); nCross1++; cond = true; } if(fast_ma1slow_ma1) State = true; if(fast_ma1