Close Positions Problem
-
Hi!
I need to solve a very huge problem with close position block. Today I lost more than 50% on options because when I close a buy position it opens a sell position automatically.
It's not the first time that it's happening to me, so i tried a lot ways to fix it like putting "once per bar" blocks before close position block, but it didn't work. Other thing I tried too was informing a deviation of 10 pips or more, but it didn't work too. So now I really don't know what to do more.
Could someone help me with it?
I really love fxdreema! Congratulation for this amazing software!
Thanks!
-
Oh no, MT5 problems again. I will check what is going on

-
The problem is that MT5 does not wait for it's local database to be updated when something important happens. For example, it can successfully close a position and the function to do that will return only success messages, but for all the other functions it will appear that the position is still present... for some time, sometimes 1 ms, sometimes seconds.
This was reported few times before, so I added some trick to wait while the local database is really updated. The trick is that the program will wait for 5 seconds (at most) for the local database to be updated after the position is closed. But maybe this happens slowly than 5 seconds for you. So I will just put an endless loop with the risk of someone complaining that his EA stuck while trying to close some position

-
Can you try on your system how it works now. Here is my test EA https://fxdreema.com/shared/aEnXaRG3e It should open a new position and then close it immediately.
-
Hi!!!
Im so sorry for delaying on my reply! I was on vacation!
Thank you very much for being so fast!
I will try it today on my system and i'll tell you later if it's working properly. For now, I solved it inserting a 'sell block' instead of a 'close position'. I know it's not the right way but It's working well.

See you later!
Thanks again!

-
Hi!!!
I have been trying to open your link but it's not working. If I open a new project will it be working with this trick that you have added?
Thank you very much!!!!

-
Oh damn, I generated it on my local fxDreema
I updated it: https://fxdreema.com/shared/aEnXaRG3e -
Hi!
It worked very fine!
If I create a new project with close position block it will work in the same way of this sample you built? Or you have to update anything?
Thanks you!!!!

-
I don't know, try it
