Hello everyone, I have a problem to determine the highest and lowest of ATR in X minutes. With those values, I want to calculate the average ATR in real time. I code this, but I have a message of error (nb is not an Integer): nb = intradaybarindex atrmax = highest[nb](AverageTrueRange[14](close)) atrmin = lowest[nb](AverageTrueRange[14](close)) middle = ABS((atrmax+atrmin)/2) return middle Thank you for your help. I wish you a perfect day