- Questions from Beginners MQL5 MT5 MetaTrader 5
- Invalid stops
- Invalid Stops in my EA Index
Hi V
It prints "stop= 1.7256 take= 1.5256" for a short on cable now. Do I care about the "full decimal places"? What I means is if the values are as printed isn't that good enough for the values passed to the ordersend command?
R
1) If this is a sub-pip pair you would want to normalise to 5 - we cant tell from the Print value as this stops at 4 decimal places unless you tweak it
2) If you hit the New Order button, are the SL and TP values available, if not, you cannot place real live orders with SL/TP values
They will have to go on afterwards by ticket number
-BB-
Hi BB
Isn't this odd I have been using this order placing code for about a year and haven't had any problems? Sorry but what do you mean by "sub-pip pair" it is GBPUSD I am trying to run the EA on? When I hit new order button there is no TP or SL and that is another strange one they were there last time I did a manual order but that was a while ago :)
Well I just read the normalise function and it says I have to do it to TP & SL but why is it giving me this problem now and not over the last year? They must have fixed something in the last upgrade that now requires the normalise function to be used. Clearly the back tester doesn't care about the decimals of TP or SL.
I changed the code but it will be a while before it trades. Thanks for your help guys but if it don't work I'll be back.
I'm Back! The thing is still giving "invalid stops error". What the hell is going on. Any more ideas will be appreciated if I haven't jumped off a cliff.
Whether the broker platform is ECN?
Some ECN don't allow you to set the TP and SL at the OrderSend() for market order.
You need to OrderModify() the TP and SL after the order successful placed in this situation.
Thanks for repeating what BB said Kolier I didn't grasp that Interbank had changed even though I could see that manually TP & SL could not be set on a new order. I have set the TP & SL to zero and now it trades. You just caught me before I left for the roof :)
Thanks Guys.
Use something like that:
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0, "",magic_number,0,clOpenBuy);
OrderSelect(ticket,SELECT_BY_TICKET);
OrderModify(OrderTicket(),OrderOpenPrice(),....StopLoss,...TakeProfit...,0,Blue);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use