Define the volatility mapping and the RSI variant separately
Chande and Kroll describe sigma = standard deviation of five closes, A = the ten-period simple average of sigma, V = sigma/A, and N = INT(14/V), bounded from 5 to 30. Their discussion uses unsmoothed RSI. The HPotter TradingView description instead gives a minimum of 3. These are different parameter choices; a script name alone does not identify the calculation. Because the length changes by bar, ta.rsi() rejects it, and a window with no up or down change stays undefined instead of printing zero.
- For each selected change delta, add max(delta, 0) to U and max(-delta, 0) to D. N changes require N + 1 closes. Recompute the complete selected window on every bar.
- At V = 1, N = 14. This output equals a 14-change unsmoothed RSI ratio, but it need not equal the built-in Wilder-smoothed RSI.
- All lengths count chart bars. A five-minute chart does not turn the five-bar volatility window into five days.
| Stage | Definition used here | Check before comparing |
|---|---|---|
| Volatility | Population standard deviation of the latest five closes | Close levels, not returns or true range |
| Reference volatility | SMA of ten sigma values, including the current bar | Requires 14 consecutive valid closes |
| Effective length | N = max(lower, min(upper, floor(14/V))) | Round down before using the integer window |
| Oscillator | 100 × U/(U + D), using the latest N one-bar changes | No Wilder recursion or added smoothing |