Orders Execution
0
Views
0
Downloads
0
Favorites
Pending Orders
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
void init()
{
// Create some Orders
double iBuyPrice = 0;
double iSellPrice = 0;
iBuyPrice = Ask;
iSellPrice = Bid;
iBuyPrice = iBuyPrice - 0.0020;
iSellPrice = iSellPrice + 0.0020;
OrderSend(Symbol(), OP_BUYLIMIT, 1, iBuyPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
OrderSend(Symbol(), OP_BUYLIMIT, 1, iBuyPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
OrderSend(Symbol(), OP_SELLLIMIT, 1, iSellPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
OrderSend(Symbol(), OP_SELLLIMIT, 1, iSellPrice, 4, 0, 0, "", 123456789, 0 ,Blue);
Print("Total Pending Orders (init): ", GetTotalPendingOrders());
}
void start()
{
// start what?
Print("Total Pending Orders (start): ", GetTotalPendingOrders());
}
int GetTotalPendingOrders()
{
int iCounter = 0;
int iSelectedOrderType = 0;
int iPendingOrders = 0;
for(iCounter = 0; iCounter < OrdersTotal(); iCounter++)
{
if ( OrderSelect(iCounter, SELECT_BY_POS, MODE_TRADES) == true )
{
iSelectedOrderType = OrderType();
if ( iSelectedOrderType == OP_BUYLIMIT || iSelectedOrderType == OP_BUYSTOP || iSelectedOrderType == OP_SELLLIMIT || iSelectedOrderType == OP_SELLSTOP )
{
iPendingOrders = iPendingOrders + 1;
}
}
else
{
Print("Unable to select order: ", iCounter);
}
}
return (iPendingOrders);
}
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
---