Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I make Keltner RSI?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I make Keltner RSI?

    The Keltner RSI uses the simple moving average, whereas Wilder's RSI, as provided by NinjaTrader, employs Wilder's moving average (similar to EMA).

    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:
    1. 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.
    2. 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.
    3. 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?




    #2
    Hello hybinubt,

    Below is a link to a support article with helpful resources on getting started with C# and NinjaScript.


    What challenges are you having?
    What have you coded so far?

    This doesn't appear to be NinjaScript or C#. Is this written in a different language?

    Where you have:
    T = (C + H + L) / 3

    I think this translates to:
    MyTypicalSeries[0] = (Close[0] + High[0] + Low[0]) / 3;

    Where you have:
    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)]

    I think this translates to:
    Value[0] = 100 * new int[] { Math.Max(0, MyTypicalSeries[0] - MyTypicalSeries[1]), Period }.Sum() / new int[] { Math.Max(0, MyTypicalSeries[1] - MyTypicalSeries[0]), Period }.Sum();
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X