Carl Schreiber #:
Check the offset of the stops:
- further away than minimum distance ( SYMBOL_TRADE_STOPS_LEVEL) to either ask or bid depending on buy or sell
- on the right side depending on buy or sell.
Either use Print, Comment or the debugger ...
Hi Carl,
I did this:
long x = SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL);
the result of x during debugging is 200.
Sorry but I don't understand what it means.
I fixed my logic issue, but I have a better example where I get this issue:
2022.10.17 23:08:26.778 2021.06.14 06:01:37 failed modify #8 buy 0.2 GOLD sl: 0.00, tp: 1873.30 -> sl: 0.00, tp: 1873.33 [Invalid stops] 2022.10.17 23:08:26.778 2021.06.14 06:01:37 CTrade::OrderSend: modify position #8 GOLD (sl: 0.00, tp: 1873.32) [invalid stops] 2022.10.17 23:08:26.778 2021.06.14 06:01:37 failed modify #7 buy 0.1 GOLD sl: 0.00, tp: 1883.35 -> sl: 0.00, tp: 1873.33 [Invalid stops] 2022.10.17 23:08:26.778 2021.06.14 06:01:37 CTrade::OrderSend: modify position #7 GOLD (sl: 0.00, tp: 1873.32) [invalid stops] 2022.10.17 23:08:26.778 2021.06.14 06:01:37 failed modify #6 buy 0.1 GOLD sl: 0.00, tp: 1883.35 -> sl: 0.00, tp: 1873.33 [Invalid stops] 2022.10.17 23:08:26.778 2021.06.14 06:01:37 CTrade::OrderSend: modify position #6 GOLD (sl: 0.00, tp: 1873.32) [invalid stops]
The actual price is 1862.35 (see screenshot in attached) and I want modify 3 buy positions with 1873.32 but I get invalid stops for all.
Thanks
Files:

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi guys,
I am very new in programming in MQL5 and I have an issue that make me crazy and probably is just cause of my non experience.
When I run my EA, I am buying/selling lots of GOLD if the price decrese(buy) if the price increse(sell), then my program need to update the TP of the previous open positions and I create this function:
Now is coming my problem:
time to time, not always, the EA is not able to succeed the modification of the TakeProfit. I don't understand the reason.
In attached the Positions open that I wanted modify the TP.
Thanks for any advice.