it turned out to be the broker .. they dont actually take a sl/tp with the original order when its an ea
there's a few options
- wrap it in a function and check the ret val, then modify if suits, keeping in mind if you lose power/net you have unlimited losses
- sleep (same problem as above)
- use another broker
issue a limit pending order together with the original order as tp/sl
it turned out to be the broker .. they dont actually take a sl/tp with the original order when its an ea
there's a few options
- wrap it in a function and check the ret val, then modify if suits, keeping in mind if you lose power/net you have unlimited losses
- sleep (same problem as above)
- use another broker
I don't think it's because the broker.
- 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 there,
When i submit an order, like this for example:
double SL = (o_symbol.Ask() + (Signal_StopLevelS*_Point));
double TP = (o_symbol.Bid() - (Signal_TakeLevelS*_Point));
trade.PositionOpen(_Symbol,ORDER_TYPE_SELL,1.0,o_symbol.Bid(),SL,TP);
and then look at the position
PrintFormat("- Sell: Price: '%s' SL: '%s' TP: '%s'",DoubleToString(o_position.PriceOpen(),8),DoubleToString(o_position.StopLoss(),8),DoubleToString(o_position.TakeProfit(),8));
the journal shows no SL/TP were actually submitted.
in the trading window, it doesn't submit an SL/TP order to market either..
is this the behaviour of MT5?
do you instead need to loop and watch for your SL/TP being hit and close the order?
it seems dangerous to me, it means if your computer loses power or whatever your SL/TP orders aren't in the market with the broker...
if i Sleep(5000); i can trade.positionModify() it, but its unreliable and involves a sleep etc....
any ideas?