Orders Execution
0
Views
0
Downloads
0
Favorites
Rz_Clear_All_SL_n_TP
//+------------------------------------------------------------------+
//| RoNz Auto SL n TP.mq4|
//| Copyright 2014, Rony Nofrianto |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, Rony Nofrianto"
#property link ""
#property version "1.00"
#property strict
int CalculateCurrentOrders()
{
int buys=0,sells=0;
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderType()==OP_BUY)
{
buys++;
}
if(OrderType()==OP_SELL)
{
sells++;
}
}
if(buys>0) return(buys);
else return(-sells);
}
bool ClearSLnTP()
{
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
bool res=OrderModify(OrderTicket(),OrderOpenPrice(),0,0,0,Blue);
}
return false;
}
void OnStart()
{
if(CalculateCurrentOrders()!=0)
ClearSLnTP();
}
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
---