How to set the SL level to the closest current price level?
-
Hello
Please, are you kind to help to figure out this?
I have a condition where the SL level of any opened position is moved when a TP level is reached. The EA Works pretty well but sometimes the SL is not moved as I expected and the MT5 journal logged the error showed below for each time this takes place:

So, is there a way to set "automatically" the SL level as close as posible to the current price level if my condition is not met? My condition to move the SL level is like this (On Trade)

I have added other conditions in On Tick section to try to solve the issue but it is still happening

Any suggestion will be welcome.
Thanks
Regards
-
hi can i talk to you on skype or telegram ??? +919803926981 is my telegram and hemantpremi@gmail.com my skype please write me there
-
@josecortesllobat Invalid SL appears when SL is too close or on the opposite side of the market price. I programmed the blocks to find the closest SL possible when you provide number that is too small, for example 0.1 pips. So if you try such value, you should see a message by the EA that SL is set to the minimum possible value, or something like that.
But I guess there is a possible problem that may happen sometimes. Let's say you provide a number that is too small and the EA calculated the closest possible. The EA sends the modify request to the server, but in the meantime the price moved and now the desired SL level is already on the wrong side, so it returns that error. Unfortunately I don't know how to deal with this

-
@fxDreema Thanks for your support. I guess that the blocks work as you described but I was not really sure.
Yes, it happens what you said. The SL level is not allowed to move to the price set because there is a movement in the opposite direction and now the SL price set is above (longs) the current price.
Not a problem. I have just to design a workaround for the SL logic what is very easy with your builder.
Thanks
Regards