//+------------------------------------------------------------------+ //| e-MovingInWL.mq4 | //| Êèì Èãîðü Â. aka KimIV | //| http://www.kimiv.ru | //| Äâèãàåò ñòîï â áåçóáûòîê | //+------------------------------------------------------------------+ #property copyright "Êèì Èãîðü Â. aka KimIV" #property link "http://www.kimiv.ru" //------- Âíåøíèå ïàðàìåòðû ------------------------------------------ extern int LevelWLoss = 1; // Óðîâåíü áåçóáûòêà extern int LevelProfit = 10; // Óðîâåíü ïðîôèòà extern bool ShowComment = True; // Ïîêàçûâàòü êîììåíòàðèè extern bool SoundAlert = True; // Çâóê //+------------------------------------------------------------------+ //| Custor expert deinitialization function | //+------------------------------------------------------------------+ void deinit() { Comment(""); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ void start() { bool fm; double pBid, pAsk, pp; int nd; string comm = ""; for (int i=0; i<OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { nd = MarketInfo(OrderSymbol(), MODE_DIGITS); pp = MarketInfo(OrderSymbol(), MODE_POINT); comm = comm+OrderSymbol()+" Öåíà: "+DoubleToStr(OrderOpenPrice(),nd)+ " SL=" + DoubleToStr(OrderStopLoss(),nd); if (OrderType()==OP_BUY) { comm = comm + "(" + DoubleToStr((OrderStopLoss()-OrderOpenPrice())/pp,0) + ")\n"; if (OrderStopLoss()-OrderOpenPrice()<LevelWLoss*pp) { pBid = MarketInfo(OrderSymbol(), MODE_BID); if (pBid-OrderOpenPrice()>LevelProfit*pp) { fm=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+LevelWLoss*pp,OrderTakeProfit(),CLR_NONE); } } } if (OrderType()==OP_SELL) { comm = comm + "(" + DoubleToStr((OrderOpenPrice()-OrderStopLoss())/pp,0) + ")\n"; if (OrderStopLoss()==0 || OrderOpenPrice()-OrderStopLoss()<LevelWLoss*pp) { pAsk = MarketInfo(OrderSymbol(), MODE_ASK); if (OrderOpenPrice()-pAsk>LevelProfit*pp) { fm=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-LevelWLoss*pp,OrderTakeProfit(),CLR_NONE); } } } if (fm) { if (SoundAlert) PlaySound("alert2"); break; } } } if (ShowComment) Comment(comm); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It can change open orders parameters, due to possible stepping strategy
Other Features:
It plays sound alerts