Hi,
Sorry if it's the wrong ---um, I just registered and it seems this is the only ---um where I can post!!!
Anyway, I'm new to EA, I'd like to make a really simple EA where I can manually open a hedge positions using an EA.
I have this code that I adapted from the Internet:
The problem is: it's not clear how can I manually run the EA?
Thanks in avance!
Gdhami.
PS. I need this to run via FXCM MT4 (using an fxcm-UK demo account)
Sorry if it's the wrong ---um, I just registered and it seems this is the only ---um where I can post!!!
Anyway, I'm new to EA, I'd like to make a really simple EA where I can manually open a hedge positions using an EA.
I have this code that I adapted from the Internet:
Code:
#define MAGIC 12345
#define IDENT " - EA Hedge Order" // "mo_bidir_v0_1"
extern double lots = 5500;
extern double stop_loss = 2000; // (80 pips) optimise 50-2000
extern double take_profit = 750; // (75 pips) optimise 50-2000
int last_bar = 0;
int start()
{
if (last_bar == Bars) return(0);
last_bar = Bars;
if (OrdersTotal() == 0)
{
int order_res;
order_res = OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stop_loss * Point, Bid + take_profit * Point, "Buy" + IDENT, MAGIC, 0, Blue);
if (order_res != -1) {
OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Bid + stop_loss * Point, Ask - take_profit * Point, "Sell" + IDENT, MAGIC, 0, Red);
}
}
return(0);
}
Thanks in avance!
Gdhami.
PS. I need this to run via FXCM MT4 (using an fxcm-UK demo account)
Aucun commentaire:
Enregistrer un commentaire