Orders Execution
0
Views
0
Downloads
0
Favorites
Count_Buy-Sell_Position
//+------------------------------------------------------------------+
//| Count Buy-Sell Position.mq4 |
//| Copyright 2016, Bola ButBut. |
//| https://M2P_Design@Hotmail.com |
//+------------------------------------------------------------------+
#property library
#property copyright "Copyright 2016, Bola ButBut."
#property link "https://M2P_Design@Hotmail.com"
#property version "1.00"
#property strict
input int Magic=280456;
//+------------------------------------------------------------------+
//| Count Buy Orders function |
//+------------------------------------------------------------------+
int CountB()
{
int cnt=0;
for(int i=OrdersTotal()-1; i>=0;i--)
{
bool OS=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType()==OP_BUY)
cnt++;
}
return(cnt);
}
//+------------------------------------------------------------------+
//| Count Sell Orders function |
//+------------------------------------------------------------------+
int CountS()
{
int cnt=0;
for(int i=OrdersTotal()-1; i>=0;i--)
{
bool OS=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType()==OP_SELL)
cnt++;
}
return(cnt);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---