What block do I use to close position if indicator reverses
-
I have a logic to open position (long or short) when cci crosses 0 level. But the position does not close automatically when cci reverses and crosses the 0 level.
What block do I use to close the open position? I used several block but without success. -
Close each trade (in MQL4) or Close each position (in MQL5), it's a blue block.
-
Where do I place this Close each trade (in MQL4) block? I tried several options, but doesn't work. See my ea called "simple ma cross test". Where should I place this block in this ea.
Thanks,
-
Place that block where it's needed!
Normally the EA does what it does on every tick. When a tick comes - certain code is executed. In fxDreema this is when you put blocks in "on Tick". So, when a new tick comes - the blocks on the top in "on Tick" will be executed. Depending on what they do, the blocks below them will be/will not be executed. The logic flows from the top to the bottom.
In your case, "No trade is running" is executed on every tick. When there are trades and the yellow output is active, the next blocks will be executed - in your case two "Close each losable trade". The "Condition"-s that follows does not matter in your connection. So maybe you can try to put them above the "Close..." blocks

Another block that is frequently used with "Condition" is "Once per bar"... just in case.