Passing a condition for the entire candle
-
Hi,
Here's a question I couldn't find in the forum.
Is there a way to pass a condition for the duration of a candle?
Example of which is if a cross of a 5MA and 20MA happens during a candle but one of the conditions to buy is if a candle is above the 100MA.
In this example the 5MA and 20MA (On an indicator) happens first or at the beginning of a candle (triggering the pass) but the price is below the 100 MA. The price then moves past the 100MA during the candle, however the buy does not execute because the cross has already happened.
Is there a way for a PASS to last for the duration of the candle and all conditions below it gets calculated? Meaning the crossover event keeps passing until the end of the candle and the buy is executed when/if the candle crosses the 200 MA?
Thanks again!!
-
"Condition" block always gives continuous signals. This block checks some values and passes (to one of its outputs). Normally this block is somewhere in "on Tick", so it runs over and over again, on each tick. If the values doesn't change so much in the period of few ticks, the block would pass the same way once for each of these ticks. That's why "Once per bar" can be used to produce only 1 signal of all these passes. If "Once per bar" is above "Condition", then the condition would be checked at the beginning of the candle. Or, if "Once per bar" is below "Condition", then "Condition" could pass in the middle of the candle and "Once per bar" will also pass at that time - in the middle of the candle.
-
@fxdreema Thanks for clarifying, got most of this working !!
-
@fxdreema Hello, My question is does the "Once per bar" condition placed at the top of a trade logic means there would only be a single pass made during the course of the candle formation even if the period of reference is Daily and there are "conditions" in the logic for the current candle?
Also how does using the "Max times to pass" option in the "Once per bar" condition tie into my first question?
-
@woman yes, just a single pass. "Max times to pass" changes that amount - if 5, for example, the block will pass 5 times (on the first 5 price updates of that particular candle).