What is the problem ?
Marco vd Heijden:
What is the problem ?
What is the problem ?
The order is modified 2 times successfully. On 3rd time it shows an error 130. OrderSL is the new stoploss value.
2020.06.17 20:09:36.153 2020.06.09 03:41:28 ADX_Trailing_SL EURUSD,M15: Last Error #130 2020.06.17 20:09:36.153 2020.06.09 03:41:28 ADX_Trailing_SL EURUSD,M15: OrderModify error 130 2020.06.17 20:09:36.153 2020.06.09 03:41:28 ADX_Trailing_SL EURUSD,M15: #15 2020.06.09 00:30:00 sell 0.20 EURUSD 1.1287 1.1287 0.0000 1.1262 0.00 0.00 50.00 Sell Trade 0 2020.06.17 20:09:36.153 2020.06.09 03:41:28 ADX_Trailing_SL EURUSD,M15: modify #15 sell 0.20 EURUSD at 1.1287 sl: 1.1267 tp: 0.0000 ok 2020.06.17 20:09:36.153 2020.06.09 03:41:27 ADX_Trailing_SL EURUSD,M15: #15 2020.06.09 00:30:00 sell 0.20 EURUSD 1.1287 1.1307 0.0000 1.1261 0.00 0.00 52.00 Sell Trade 0 2020.06.17 20:09:36.153 2020.06.09 03:41:27 ADX_Trailing_SL EURUSD,M15: modify #15 sell 0.20 EURUSD at 1.1287 sl: 1.1287 tp: 0.0000 ok 2020.06.17 20:09:36.059 2020.06.09 00:30:00 ADX_Trailing_SL EURUSD,M15: open #15 sell 0.20 EURUSD at 1.1287 sl: 1.1307 ok
modify #16 buy 0.20 EURUSD at 1.1353 sl: 1.1353 tp: 0.0000 ok
Marco vd Heijden:
modify #16 buy 0.20 EURUSD at 1.1353 sl: 1.1353 tp: 0.0000 ok
Yes. Modifying SL to Open Price. Is it wrong? But the modify order is OK, right?
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
Keith Watford:
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
Fine. Can you help me here?
if(OrderType()==OP_BUY) { currentPrice = Bid; OrderSL = OrderStopLoss() + SL * Point; } else if(OrderType()==OP_SELL) { currentPrice = Ask; OrderSL = OrderStopLoss() - SL * Point; }The new SL is not the current SL ± n
William Roeder:
The new SL is not the current SL ± n
The new SL is not the current SL ± n
Why not? I am trying to move the SL in the direction of the market. Can you explain why New SL is not Current SL +- n?
Gopalakrishna R: I am trying to move the SL in the direction of the market.
That's what you want, not what you are doing. When in doubt, THINK, or Use the debugger or print out your variables, including _LastError and prices and find out why. - SL=1.0000 Bid=1.0040
- SL=1.0010 Bid=1.0041
- SL=1.0020 Bid=1.0040
- SL=1.0030 Bid=1.0041
- SL=1.0040 Bid=1.0040 invalid SL
William Roeder:
That's what you want, not what you are doing. When in doubt, THINK, or Use the debugger or print out your variables, including _LastError and prices and find out why.
That's what you want, not what you are doing. When in doubt, THINK, or Use the debugger or print out your variables, including _LastError and prices and find out why.
- SL=1.0000 Bid=1.0040
- SL=1.0010 Bid=1.0041
- SL=1.0020 Bid=1.0040
- SL=1.0030 Bid=1.0041
- SL=1.0040 Bid=1.0040 invalid SL
Thank you. I fixed it finally.

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
Dear All,
I trying to write a code to Trail Stop Loss.
In Opening the order,
and SL = 20;
Please tell me what should correct here. Thanks in advance.