Printing multiple trades to a log.
-
Hi fxDreema,
First, I'd like to say thanks for the work that you've done here..

I'm trying to get an EA that would get the currently running trades logged to a file. After several attempts, I was able to get something working with the for each loop blocks. This code: https://fxdreema.com/shared/VzkmPLhgd works fine for one trade, (the print message and modify variable blocks are just for testing) but it doesn't work well with multiple trades. I may get one or two trades at best.
Am I doing this the right way? Is there a way to parse/separate the multiple trades currently running and write them to a log? any help is appreciated.
Thanks!
-
Nevermind! I found a fix looking through the forums here..

Thanks again!
-
For each Trade is the important block here. You can run this block once, and it's orange output will be active 10 times in a row if you have 10 trades. Of course, this is not mandatory, because the block has filter settings, so you can choose to skip some of the trades. And in your case the block runs on every tick.
Then you have once per trade/order - this one monitors trades/orders that For each Trade is loading and it will pass once for every unique ticket number. It has something like private database where it writes ticket numbers that were passed once. Note that this private database is deleted when you reload the EA

So, even if block 2 passes 10 times per tick, on every tick, the check profit block is reached only few times. As many times as many trades are created. For example, 10 times for the whole lifetime of that EA