@dazmed9 the idea if this loop is that it compares a condition on a candle then adds 1 and checks the next, so constants cant be used where you have them, if you have the loop returning what's wanted then have a separate tree with conditions to check loop you can use many options, as a general rule I have loops returning values I can use, then separately use the data.