Orders Execution
0
Views
0
Downloads
0
Favorites
HedgingEA_CodersGuru
//| Hedging.mq4 |
//| Coders Guru |
//| http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "http://www.forex-tsd.com"
extern string Sym_1 = "EURUSD";
extern string Sym_2 = "USDCHF";
extern double Lots = 1;
extern int Slippage = 5;
bool Sell = true;
//+------------------------------------------------------------------+
int start(){
int cnt,total;
if(Bars<100) {Print("bars less than 100"); return(0);}
total = OrdersTotal();
if(total < 1) {
if(Sell==0) {
RefreshRates();
OrderSend(Sym_1,OP_BUY,Lots,MarketInfo(Sym_1,MODE_ASK),Slippage,0,MarketInfo(Sym_1,MODE_ASK)+1000*Point,"Hedging",1234,0,Green);
RefreshRates();
OrderSend(Sym_2,OP_BUY,Lots,MarketInfo(Sym_2,MODE_ASK),Slippage,0,MarketInfo(Sym_2,MODE_ASK)+1000*Point,"Hedging",1234,0,Green);
} else {
RefreshRates();
OrderSend(Sym_1,OP_SELL,Lots,MarketInfo(Sym_1,MODE_BID),Slippage,0,MarketInfo(Sym_1,MODE_BID)-1000*Point,"Hedging",1234,0,Red);
RefreshRates();
OrderSend(Sym_2,OP_SELL,Lots,MarketInfo(Sym_2,MODE_BID),Slippage,0,MarketInfo(Sym_2,MODE_BID)-1000*Point,"Hedging",1234,0,Red);
} return(0);
} 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
---