Orders Execution
0
Views
0
Downloads
0
Favorites
Competition
#property copyright "Copyright © 2006, Peradze Gulik."
extern int Bars_Open_Level = 50;
int MaxOrders = 3,LastBars = 0,Last_Oper;
double Min_Open_Low,Max_Open_High;
int init()
{
Last_Oper = CurTime() - 60;
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int Tmp,Lots = 0;
if(Bars < 100) return(0);
if(LastBars != Bars)
{
LastBars = Bars;
Min_Open_Low = 0;
Max_Open_High = 0;
for(Tmp = 0;Tmp < Bars_Open_Level;Tmp++)
{
if(Max_Open_High < High[Tmp] || Max_Open_High == 0) Max_Open_High = High[Tmp];
if(Min_Open_Low > Low[Tmp] || Min_Open_Low == 0) Min_Open_Low = Low[Tmp];
}
}
if(OrdersTotal() < MaxOrders && Last_Oper + 60 <= CurTime())
{
if(AccountFreeMargin() > 2500) Lots = 2;
else if(AccountFreeMargin() > 1500) Lots = 1;
if(Close[0] > Max_Open_High && Lots != 0)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask + 50 * Point,Bid - 20 * Point,"",0,0,Red);
Last_Oper = CurTime();
}
if(Close[0] < Min_Open_Low && Lots != 0)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid - 50 * Point,Ask + 20 * Point,"",0,0,Green);
Last_Oper = CurTime();
}
}
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
---