Please can someone tell me what might be the problem??
Yes, one Broker is an ECN Broker and the other isn't. ECN
What is . . . .
if (false)
. . . supposed to do ?
false is always false . . . i.e. never true
The code in the { } will never be executed . . .
What error do you get back when your OrderSend fails ? oh of course . . . you don't check. ALWAYS test return values and report errors when there is a problem . . . .
double SL = Ask - BuyStoploss7*PipValue*Point; if (BuyStoploss7 == 0) SL = 0; double TP = Ask + BuyTakeprofit7*PipValue*Point; if (BuyTakeprofit7 == 0) TP = 0; int ticket; ticket = OrderSend(Symbol(), OP_BUY, BuyLots7, Ask, 2, 0, 0, "My Expert", 1, 0, Blue); if (ticket > 0) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); }Code it like that :)
Code it like that :)
But also report the error if the OrderSend() has failed . . .
double SL = Ask - BuyStoploss7*PipValue*Point; if (BuyStoploss7 == 0) SL = 0; double TP = Ask + BuyTakeprofit7*PipValue*Point; if (BuyTakeprofit7 == 0) TP = 0; int ticket; ticket = OrderSend(Symbol(), OP_BUY, BuyLots7, Ask, 2, 0, 0, "My Expert", 1, 0, Blue); if (ticket >= 0) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); }
But also report the error if the OrderSend() has failed . . .
Dear RaptorUK, ...
OrderSend()
... never return zero, either -1 or > 0
If it is return zero then it is fail ...
:)
Dear RaptorUK, ...
... never return zero, either -1 or > 0
If it is return zero then it is fail ...
:)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi, i created an EA and made it run in 2 different metatrader platforms, one in hotforex, and another in ironfx. The below code works in ironfx and doesn't work in hotforex whereas both platforms are 5 decimal.
Please can someone tell me what might be the problem??