I attempted to create a Keltner RSI indicator using the NinjaScript editor, but I encountered repeated challenges.
Below is the logic I devised for the Keltner RSI. Instead of using the closing price (C), I utilized the Typical Price (T), defined as:
T = (C + H + L) / 3
The formula for Keltner RSI is as follows:
RSI(Period) = 100 * [Sum(if (T - T(1) > 0, T - T(1), 0), Period)] / [Sum(if (T - T(1) > 0, T - T(1), T(1) - T), Period)]
Explanation:
- Upward Changes:
Sum(if (T - T(1) > 0, T - T(1), 0), Period)- If the current Typical Price (T) is higher than the previous bar’s Typical Price (T(1)), add the difference (T - T(1)).
- Otherwise, add 0. This represents the sum of upward changes over the period.
- Upward + Downward Changes:
Sum(if (T - T(1) > 0, T - T(1), T(1) - T), Period)- If the current Typical Price (T) is higher than the previous bar’s Typical Price (T(1)), add the difference (T - T(1)).
- Otherwise, add the absolute difference in reverse order (T(1) - T).
- This results in the total of upward and downward changes over the period.
- RSI Calculation (Upward/Total Changes):
Divide the sum of upward changes (Section 1) by the total changes (Section 2), and multiply the result by 100 to convert it into a percentage.
Is there any way to make Ninjascript indicator that follows above logic?

Comment