Calc profit of first and last trade. And Once per Position block.
-
I'd like to implement something into my grid trading bot. It takes the first and last trade of a batch, and closes out when in x pips profit.
I can get/calc the average open, average lots and therefore calculate the profit of first and last trade, but I need to do this only once when x amount of trades is open. So I decided to use the 'Once per Position' block.
However, I cannot get the Once per Position block to run.
I have tested this on a separate project, so I understand it and it works as expected on a bare project. (eg when I set it to '3' trades, when 3 trades are open, the connected blocks run once).
However, on quite a complex EA, I can't get the block to fire, no matter if I put it where I want it or at the top with no parent blocks. I am wondering whether the block ID has something to do with it? As it's the highest numbered block in the project.
Anyone have any idea what I could be doing wrong?
-
Actually - using the 'otherwise' output I can see block is firing. But when I set "How many trades?" to the exact number of trades I want (for example, 3rd trade) to execute following blocks at...nothing happens.
But the 'otherwise' output fires before and after the 3rd trade, when it's set to '3'.
Very strange.
-
OK this is weird - I can get it to fire but only after 2 trades - then it fires once for EVERY trade.
-
Could you please share the link to your project?
-
It's OK I solved the problem without using that block.
Must've been an issue with what I was doing as with blank project that block worked fine.
-
Good for you!
