"For each closed position" block doesn't loop trades as specified
-
Hi all. The abovesaid block - which I understand is meant to work as a loop - only performs the required action once and then stops altogether i.e. I want it to place "sell pending orders in grid" every two buy positions closed; and "buy pending orders in grid" every two sell positions closed. What changes should I make? See below a snap and the link. Thanks
https://fxdreema.com/shared/ttNvREDyd

-
Do you mean waiting for the last two sell trades to be closed and then a new buy grid to be programmed? That 'once per positions' block doesn't help. You should use a boolean variable instead controlling that grid happened and then waiting for two more sells to be closed to allow the new grid.
-
Yes, that's precisely what I mean. I tried it first without the 'once per positions' block, but this caused it to uncontrollably place unwanted grids with every tick. How do I go about using the boolean variable as you suggest (haven't used it before)?
Would this work?

-
You need a no position/order block on top, so this restricts new trades opening
-
With the 'no position' or 'no position/order' blocks on top, it doesn't place the new grids at all (unless the boolean settings are incorrect?). I have also tried restricting the 'no position/order' blocks to 'sells' in the case of buy grids, and 'buys' in the case of the sell grids. See link (https://fxdreema.com/shared/KEtKkOe4b) and snaps below





-
This will only work if there's no existing trade, if there is you will need to use groups or another way to restrict trade.
-
See edits to above reply - any further comments/observations? Also, I notice that it doesn't work on the "On trade" tab - how can I get it to work here, since this is not based on ticks?
-
Hello @ambrogio - do you have any insights/thoughts on the above issue?
-
i think .... create a variable eg.: countbuy, then in "on trade" section > trade closed buy > modify variable countbuy +1
then in "on tick" put a condition countbuy==2 > no sell pending order > sell pending order -
Reset variable
-
Is this correct? - https://fxdreema.com/shared/2uffZWHX
-
not a constant, a variable. But only now i see you want like a loop. This way should work

-
@ambrogio Thanks a lot - I also tried another way (pic below, in the "on trade" tab) and both work! Keep well

-
@Lerumo you're welcome!