Author: Copyright � 2005, MetaQuotes Software Corp.
TS
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
TS
//+------------------------------------------------------------------+
//|                                                     Scalping.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.scalping.nm.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.scalping.nm.ru"

//---- input parameters
extern int       TS=25;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   int cnt;
//---- 
if (TS<5)
   {
   Print("Ìàëåíüêèé òðåéëèíã");
   return(0);
   } 
for(cnt=0;cnt<OrdersTotal();cnt++)
{
   if (OrderSelect(cnt,SELECT_BY_POS)==true)
   {
      if (OrderSymbol()==Symbol())
      {
         if (OrderType()==OP_BUY)
         {
            if (Bid-OrderOpenPrice()>TS*Point)
            {
               if (OrderStopLoss()<Bid-TS*Point)
               {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TS*Point,OrderTakeProfit(),0,Red);
               }
            }
         }
         if (OrderType()==OP_SELL)
         {
            if (Ask-OrderOpenPrice()>TS*Point)
            {
               if (OrderStopLoss()<Ask-TS*Point)
               {
                  OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TS*Point,OrderTakeProfit(),0,Blue);
               }
            }
         }
      }
   }
}
//----
   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 ---