//+------------------------------------------------------------------+ //| _StopLossMove.mq4 | //| "ÑÊÐÈÏÒÛ ÄËß ËÅÍÈÂÎÃÎ" | //| Ñêðèïò ïåðåìåùàåò StopLoss íà Distance îò ðûíêà | //| Bookkeeper, 2006, yuzefovich@gmail.com | //+------------------------------------------------------------------+ #property copyright "" #property link "" //#property show_inputs //+------------------------------------------------------------------+ extern int Distance=5; // Ðàññòîÿíèå îò ðûíêà | extern bool UpDoun=true; //äëÿ òîëüêî "ïîäòàñêèâàíèÿ" ê ðûíêó =false | //äëÿ è "ïîäòàñêèâàíèÿ" ê ðûíêó è "îòñêîêà" îò ðûíêà =true | //+------------------------------------------------------------------+ void start() { double NewPrice; int i,Total,Dist; int Dgts=MarketInfo(Symbol(),MODE_DIGITS); bool GoGo; //+------------------------------- ÓÇÍÀÒÜ ÎÃÐÀÍÈ×ÅÍÈÅ ÑÂÎÅÃÎ ÄÖ -----+ // if(Distance<10) Dist=10; // else Dist=Distance; //+------------------------------------------------------------------+ Total=OrdersTotal(); if(Total>0) { for(i=Total-1; i>=0; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true) { if(OrderSymbol()==Symbol() && OrderType()==OP_SELL) { NewPrice=Ask+Dist*Point; if(UpDoun==true) GoGo=true; else { if(OrderStopLoss()>NewPrice) GoGo=true; else GoGo=false; } if(GoGo==true) if(OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(NewPrice,Dgts), OrderTakeProfit(), OrderExpiration(), CLR_NONE)!=TRUE) Print("LastError = ", GetLastError()); } if(OrderSymbol()==Symbol() && OrderType()==OP_BUY) { NewPrice=Bid-Dist*Point; if(UpDoun==true) GoGo=true; else { if(OrderStopLoss()<NewPrice) GoGo=true; else GoGo=false; } if(GoGo==true) if(OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(NewPrice,Dgts), OrderTakeProfit(), OrderExpiration(), CLR_NONE)!=TRUE) Print("LastError = ", GetLastError()); } } } } } //+------------------------------------------------------------------+
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: