What was the Spread, what was the MODE_STOPLEVEL ?
Thanx for your reply
SPREAD = 26.00000000
STOPLEVEL = 0.00000000
BTW the TP and SL value i have set are more than the spread
Regards,
Master
Thanx for your reply
STOPLEVEL = 0.00000000
Probably an ECN Broker . . you have to send the order with TP & SL = 0 the do an OrderModify to add the TP and SL to the order . . .
SL = Ask - StopLossPips * Point; TP = Ask + TakeProfitPips * Point; Print("==-----ORDER SENDING PERIMETERS-----=="); Print("SYMBOL IS = " + Symbol()); Print("ORDER TYPE = OP_BUY");
On a buy you OPEN at the ask, your stops are relative to the BID (likewise the sell code)
Do you really want your SL=3 pips - spread and TP=6 pips + spread.?
Adjust for 4/5 digit brokers, TP, SL, AND slippage. On ECN brokers you must open first and THEN set stops.
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 https://www.mql5.com/en/forum/135345 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(..., 0,0,...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_TICKET)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0) Alert("OrderModify failed: ", GetLastError()); */
Thanx for all your kind replies guys.
What i am doing now is that i am sending base order with SL & TP set to 0 and then i try to modify it afterwards. I have tried it on FXCM as well as OANDA MT4. It works flawlessly on OANDA but there's this same error in FXCM when i try to modify; i.e
2011.11.16 13:08:58 '2089354627': modification of order #61408632 sell 0.01 EURUSD at 1.34610 sl: 0.00000 tp: 0.00000 -> sl: 1.34636 tp: 1.34546 failed [Invalid S/L or T/P]
So any idea why this is happening?
I'd appreciate any help.
Thanx & Regards,
Master
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey there guys,
I'm getting this problem and dunno what is the reason. Following is an excerpt from my log;
Here's my order placing function;
Can any1 please help me out by pointing out what i am doing wrong here.
Regards,
Master