#232507
Wim

Try dropping the part (minute=15….) for starters. You have already forced the timeframe to M15, no need to check whether minute=n*15. And moreover, all calculations are made for the values at the end of a candle, and the end of the 10:15 candle is 10:30 etc.