//+------------------------------------------------------------------+ //| MODIFY.mq4 | //| Copyright © 2006, Shadow Trader | //| mailto:ShadowDragon_Fil@mail.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Shadow Trader" #property link "http://forum.alpari-idc.ru/thread32559.html" #property show_inputs #include <stdlib.mqh> extern double Take_Profit = 0; extern double Stop_Loss = 0; extern string Order_Type = "BUY"; extern string Order_Symbol = "EURUSD"; int start() { int type = 0; if (Order_Type == "BUY") type = OP_BUY; else if (Order_Type == "SELL") type = OP_SELL; else if (Order_Type == "BUY LIMIT") type = OP_BUYLIMIT; else if (Order_Type == "SELL LIMIT") type = OP_SELLLIMIT; else if (Order_Type == "BUY STOP") type = OP_BUYSTOP; else if (Order_Type == "SELL STOP") type = OP_SELLSTOP; else { Alert("Íå âåðíî çàäàí òèï îðäåðà: " + Order_Type); return (0); } if (!IsConnected()) { Alert("Îòñóòñòâóåò ñâÿçü ñ ñåðâåðîì!"); return (0); } if (!IsTradeAllowed()) { Alert("Òîðãîâëÿ çàïðåùåíà!"); return (0); } bool find = false; // ïîèñê îðäåðà for (int i = 0; i <= OrdersTotal(); i++) { if((OrderSelect(i, SELECT_BY_POS, MODE_TRADES )) && (OrderSymbol() == Order_Symbol) && (OrderType () == type)) if ( OrderSymbol() == Symbol() ) { int j = 0; while (!OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Take_Profit, Digits), NormalizeDouble(Stop_Loss, Digits), OrderExpiration(), CLR_NONE)) { int error = GetLastError(); if (error > 0) { Print("Îøèáêà ïðè ìîäèôèêàöèè! ", error, ", \"", ErrorDescription( error ), "\"" ); } Sleep(1000); if ((j > 2) || IsStopped()) break; j++; } while (IsTradeContextBusy() && !IsStopped()) Sleep(1000); find = true; } } if (!find) { Alert("Íå íàéäåíû îðäåðà ïî óêàçàíûì ïàðàìåòðàì!"); } return(0); } int deinit() { return(0); }
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 issuies visual alerts to the screen