Conditional within loop
-
Hello,
Been having difficulty adding conditionals to loops, what I want to do is for every trade, once lets say 10 and 100 SMA crossover happens, add volume to my trade every 5 pips. Do you add the block before the loop? It didnt work so I added it towards the end. (image below)Any help much appreciated, thank you!
 -
ma cross happens - it happens between two candles, but on next candle there is no cross, only MA5>MA20 ... on next candle will be your condition (block 307) false ...
instead of AND block 379 you can connect block 307 directly
... but result from your blocks connection is repeatly adding to volume when conditions are true (tick after tick) ... for this, after adding to volume (after whole loop) you need some flag to deactive cross condition and wait for next one -
Just wanted to thank you for your help!! Problem solved. What I was looking for was more of a "while" loop, while x condition is happening, loop.
Cheers
-
Be careful when a block is outlined in red or blue. Red outline means that the block is added to the output code, but will be unable to run. That blue outline also means something very specific... which is also hard to explain here, but you can see this: https://fxdreema.com/demo/mt4-wait-crossovers