Orders Execution
0
Views
0
Downloads
0
Favorites
CloseAllPositive
//+------------------------------------------------------------------+
//| CloseAllPositive Scripts by ***NicoMax*** |
//| |
//| Close All Open order with positive profit |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
extern int Slippage = 1;
int start()
{
bool Result;
int Pos,Error,Total;
for(int i=1; i<=OrdersTotal(); i++)
{
if (OrderSelect(i-1,SELECT_BY_POS)==true)
{
if ( OrderProfit()>1)
{
Pos=OrderType();
if(Pos==OP_BUY)
Result=OrderClose(OrderTicket(),
OrderLots(),
Bid,
Slippage,
CLR_NONE);
else
Result=OrderClose(OrderTicket(),
OrderLots(),
Ask,
Slippage,
CLR_NONE);
}
}
}
return(0);
}
//+------------------------------------------------------------------+
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
---