BUG (On Trade Event)
-
Dreema, look at this: http://prntscr.com/al8toa
My EA is working perfectly. But, when I put anything on the "On Trade Event", it crashes, right in the close of the first trade it makes:
http://prntscr.com/al8v9lWhat I wanna do is a Money withdraw after every order closed. This "money withdraw" would simulate de comissions paid into the backtests.
Know something better to do this? Can we fix this bug?
ty
-
Wow, this error shows some Assembly code! This was bug in the MQL4/MQL5 compiler. I updated it and not it should work. But because they also changed the way files are compiled (now metaeditor.exe is used instead of a standalone mql.exe file), I expect other problems when compiling files

-
Nice! the assembly bug is gone.
Now got a new one, look at this: http://prntscr.com/alkfibOk, when some position get closed by the "Close positions" blue box into somewhere into by "On Tick Event", it activates the Screenshots's purple block "Position Closed" on the "On Trade Event" tab and it gets traced by the pink line and the withdraws are made perfectly.
BUT, when the positions gets closed by a STOP LOSS, it does not activates the the "Position Closed" box, and it does not make the withdraws of the comissions. Look: http://prntscr.com/alk8ff
The "Position Closed" purple block is not recognizing Stop-loss closed positions.
Can be fixed or made in another way?
ty
-
What information do you have here: http://prntscr.com/aln6cn
At least on backtesting, this works for me - https://fxdreema.com/shared/QiVNz2cbc
-
-
Ok, I need glasses 8-)
Anyway. It's had for me to say what is wrong. It appears to be working for me - http://prntscr.com/alpk13 I don't know... look for errors in the log?
-
Dude, help me, I really think there is something going wrong here.
Looking at this SS, we se two stop-losses trade happening at the same day: http://prntscr.com/alqjim
The first stop-loss trade did not pass the "Position Closed" block. But the second did.

You can see the blue dot that shows that the "On Trade event" tab got activated correctly, but, somehow, the just the second trade got passed in the "Position Closed" block.
Btw, no other SL positions passed the "Position Closed" block after this succesfull one

How could it be explained?

-
Is it working for something like EURUSD?
-
Dude, help me, I really think there is something going wrong here.
Looking at this SS, we see two stop-losses trades happening at the same day: http://prntscr.com/alqjim
The first stop-loss trade did not pass the "Position Closed" block. But the second did.

You can see the blue dot that shows that the "On Trade event" tab got activated correctly, but, somehow, the just the second trade got passed in the "Position Closed" block.
Btw, no other SL positions passed the "Position Closed" block after this succesfull one

How could it be explained?

Last edited by owneroxxor on Tue Mar 29, 2016 11:06 pm, edited 1 time in total. -
I don't know if it could work on FOREX currencies.
-
I think I got it. After any position get closed by a stop-loss, in my "On tick Event" there is a routine that: once there is less than two orders into the graph, it CANCELS all the current pending orders and create two new. What happens is that just before the "On trade Event" which makes the withdrawal after the stopped position, the EA executes this routine that cancels the pending order that remained, and I think the "Position Closed" box on the "On trade Event" doesnt recognize CANCELED orders as a trigger. So the block doesnt pass. Am I right in saying this?
-
Ok, the routine is causing the "BUG". When I disable it, it works. BUT, still not right, because I need this routine working.
So I tried to just wipe that "Position Closed" box and put a "For each closed order" loop right after the "PASS" block, but with a "Once per position" box inside it, to prevent it from withdrawaling the same last position all times "On trade Event" tab gets activated. Logically it should work all times it see's a fresh new closed position on the Foreach Loop that is not a CANCELED one (Check Profit Condition Box). but look:
http://prntscr.com/alry5uhow to overcome this?
The "Once per position/order" box is causing this, btw.
ty
-
OnTrade() runs multiple times and this is normal for MT5. Even if something simple as closing a position happens, you know, this results in some deals and orders, many things. For each ot these "Pass" will run. That's why the events must be filtered.
I guess that something is going on because of the strange symbol. I don't even know what this WDO$ is. I am working with EURUSD most of the time. If you can give me demo account or something like that, so I can check it out...
-
Why the symbol? lol The symbol is ok. WDO$ mean, W-web DO-dollar $-all historical. Well I made it out using "Turn off/on" blocks. Anyway. I tryed to use the "Once per position/order" twice in 2 regions of my EA, none of them worked, returning that ugly error. Just for you 2 know.
Thanks.

-
I don't know what I was looking... I will fix that error