Hello everyone,,
I can learn since the programming on mt4 and I encounter a problem to place a sale when 2 moving averages intersect, it works on the purchase but not on sale, here is the code that I have done:
if (sell) {
// sales code here
sl = Bid + (stopLoss * factor);
sl2 = Bid + (takeProfit * factor);
if (GlobalVariableGet ("ticket")> 0)
{
OrderClose (ticket, 1, Ask, 1, Red);
ticket = OrderSend (Symbol (), OP_SELL, 1, Bid, 1, NormalizeDouble (sl, Digits), NormalizeDouble (sl2, Digits), NULL, 1234, Blue);
GlobalVariableSet ("ticket", ticket);
}
else
{
ticket = OrderSend (Symbol (), OP_SELL, 1, Bid, 1, NormalizeDouble (sl, Digits), NormalizeDouble (sl2, Digits), NULL, 1234, Blue);
GlobalVariableSet ("ticket", ticket);
}
Print (GetLastError ());
}
Can you please correct me..
sales code for EA
Modérateur : Administrateurs