Position Created block with failure.
-
I did one more change and I got a little bit more success, in particular when 2 positions and 1 pending order is created, but it doesn't work correctly when 2 positions and 2 pending orders are created. It seems that I have to rewrite the algorithm for detecting Trade events. This will probably take days.
-
@fxDreema So this problem is solved?
Can we test to validate? -
I rewrote some functions and I uploaded the changes. I did this for MQL4 and MQL5. What is different is the way events are detected, basically now the detection should work when there are multiple events happening at the same time.
Here is a project that I used to produce these events at the same time: https://fxdreema.com/shared/CKK1K7bQ What is different than your project is that initially I'm creating 2 positions and 2 pending orders. SL for both positions is the same and OpenPrice for both pending orders is the same. So all these 4 events would happen at the same time.
I used this
sllevelvariable, because I noticed anothe problem that I consider a bug. It's that if I use (in loop).... Stop-Loss in both Buy pending order blocks, the value that we get in the second block is wrong. I think Stop-Loss becomes the Stop-Loss of the pending order from the first Buy pending order block.Here is a little trick that can help you see the data of the events. In the generated source code find
debug = false;and change it todebug = true;. This will allow printing of some data in the logs, it's very nice. -
I confirm that there is a "bug" when after some of the "For each..." blocks a non-pink block is used. Like in the example in my previous post, where "Buy pending order" changes the values of "(in loop)...".
I tried to find if this is a new problem, but I think the problem is ancient, it has always been like this. I guess this explains why very often people are using pink blocks after buy/sell blocks without problems - those buy/sell blocks are acting like "For each...". So even if I find a way to fix this bug, maybe it will broke some people's projects. It looks to me like a bug, so old that it turned into a feature.
-
@fxDreema
The "For each position" block has a problem.
I have some EA's of mine that depend on this block to obtain price values only for the last order, or for all orders, but they simply get confused. Sometimes it does what it needs to do, sometimes it doesn't do what it needs to do, something intermittent, usually involving calculations.
I'm trying to draw up a project showing what kind of bug is happening and as soon as I have it I'll open a specific BUG for this block, but if you want to start reviewing it, please do so, you might find something and apply some correction before even if I try to reproduce the errors. -
@fxDreema Thanks for working on the "Position Created" block.
You are Amazing !! Thank you for the feedback !