modify_stops_DragDrop

Author: what?
modify_stops_DragDrop
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategy
0 Views
0 Downloads
0 Favorites
modify_stops_DragDrop
#property copyright "what?"
#property link      "who cares!"

//+------------------------------------------------------------------+
//| couldn't recall a fancy comment here                             |
//+------------------------------------------------------------------+
int start()
  {
//----
   int digits   = MarketInfo(Symbol(),MODE_DIGITS);
   double value = NormalizeDouble(WindowPriceOnDropped(),digits);
   for(int i=OrdersTotal()-1;i>=0;i--)
   {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderSymbol()!=Symbol())
         continue;
      
      RefreshRates();
      
      if(OrderType()==OP_BUY)     
      if(value<Bid)
         OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);
      if(OrderType()==OP_SELL)
      if(value>Ask)
         OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);      
      if((OrderType()==OP_BUYSTOP) || (OrderType()==OP_BUYLIMIT))     
      if(value<OrderOpenPrice())
         OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);   
      if((OrderType()==OP_SELLSTOP) || (OrderType()==OP_SELLLIMIT))
      if(value>OrderOpenPrice())
         OrderModify(OrderTicket(),OrderOpenPrice(),value, OrderTakeProfit(),OrderExpiration(),White);                  
   }   
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---