Orders Execution
0
Views
0
Downloads
0
Favorites
OrderBalanceControl
#property copyright "OrderBalanceControl - by transcendreamer"
// Indicator counts open positions and orders for currently selected instrument
///////////////////////////////////////////////////////////////////////////
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_color1 Red
extern int lot_multiplier=100;
///////////////////////////////////////////////////////////////////////////
int init()
{
}
///////////////////////////////////////////////////////////////////////////
int start()
{
double buy=0; double sell=0;
double buystop=0; double sellstop=0;
double buylimit=0; double selllimit=0;
int total=OrdersTotal();
for(int i=0;i<total;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
int type=OrderType();
string symbol=OrderSymbol();
if(symbol==Symbol())
{
if(type==OP_BUY) buy+=OrderLots();
if(type==OP_SELL) sell+=OrderLots();
if(type==OP_BUYSTOP) buystop+=OrderLots();
if(type==OP_SELLSTOP) sellstop+=OrderLots();
if(type==OP_BUYLIMIT) buylimit+=OrderLots();
if(type==OP_SELLLIMIT) selllimit+=OrderLots();
}
}
buy*=lot_multiplier;sell*=lot_multiplier;
buystop*=lot_multiplier;sellstop*=lot_multiplier;
buylimit*=lot_multiplier;selllimit*=lot_multiplier;
string text=StringConcatenate(
"Buy/Sell: ", buy, " - ", sell, " ",
"Stop B/S: ", buystop, " - ", sellstop, " ",
"Limit B/S: ", buylimit, " - ", selllimit);
ObjectCreate("Balance Control",OBJ_LABEL,0,0,0);
ObjectSet("Balance Control",OBJPROP_CORNER,1);
ObjectSet("Balance Control",OBJPROP_XDISTANCE,3);
ObjectSet("Balance Control",OBJPROP_YDISTANCE,1);
ObjectSetText("Balance Control",text,8,"Tahoma",indicator_color1);
}
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
---