doubt with "for each closed trade" and with "loop (pass" n "times)"
-
Hi guys, I have a question with these operators: In my EA, there is a loop that I want to repeat exactly 3 times. For this I have tried these two operators, but I find that the loop never stops executing, it does not stop at number 3 but continues until I stop it manually. I have used the operators the way I teach you in the images. I have also thought that if I removed the loop from "on tick" and put it in "on trade" it might fix the fact that it does not repeat permanently, but I don't know if this makes sense.
Lastly, I thought about repeating the loop and its operators 3 times in the layout, that way I would fix it but it wouldn't seem like a clean job to me and I would add a lot of unnecessary code to my EA.
Anyway, I hope you can help me, thank you very much.
All the best

-
@esteban_d Hello,
I would use the (Counter: pass 'n' times) block and i would place it after block 5 probably. that would make sure that this loop will pass 3 times only. In this case you can also reset this counter if you want. I don't remember ever using the (Loop: pass 'n' times) block, but my assumption is that you may also need to place it after block 5.
I hope this works

-

You don´t need to use the block Loop because For each Close Trade is a looping block, so this block loops through all trades that matches the filter settings. So if you want to catch the last 3 trades just put the number in Not More Tahn n history trades, Try... -
@q8carpenter @diazoviedo I'm going to try those two options to see what happens, I'll tell you about it, thank you very much
-
Resolved using "Counter: pass 'n' times". Thank you again for answers!