CamelModify

Author: sanyooooook
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategy
2 Views
0 Downloads
0 Favorites
CamelModify
//+------------------------------------------------------------------+
//|                                                  CamelModify.mq4 |
//|                                                      sanyooooook |
//|                                                 sn-bot@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "sanyooooook"
#property link      "sn-bot@yandex.ru"
#property version   "1.00"
#property strict
double Price=3000;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---
   Price=WindowPriceOnDropped();
   for(int i=OrdersTotal()-1;i>=0;i--)
   {
      if(OrderSelect(i,SELECT_BY_POS)&&OrderSymbol()==Symbol())
      {
         RefreshRates();
         int cmd=OrderType();
         if(cmd==OP_BUY&&(Price>Ask||Price==0))
         {
            if(OrderModify(OrderTicket(),OrderOpenPrice(),0,NormalizeDouble(Price,Digits),0))continue;
         }
         if(cmd==OP_SELL&&Price<Bid)
         {
            if(OrderModify(OrderTicket(),OrderOpenPrice(),0,NormalizeDouble(Price,Digits),0))continue;
         }
      }
   }
   return;
}
//+------------------------------------------------------------------+

Comments