Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

plot the difference in RSI value

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

    plot the difference in RSI value

    Hi ,
    I have been trying to Addplot the difference between rsi of two instruments: RSI1=RSI (ES) and RSI2 = RSI (RTY). However, it just plots the current value , without historical value (current value=8.69 and all previous value = 0. see first screenshot attached).
    below is my code and it's rather straightforward so I am confused what could have gone wrong.
    Appreciate your help !


    ........
    Instrument2Close = new Series<double>(this);
    rsi1 = new Series<double>(this);
    rsi2 = new Series<double>(this);​
    ............

    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
    return;

    Instrument2Close[0] = Closes[1][0];

    rsi1[0] = RSI(14,1)[0];
    rsi2[0] = RSI(Instrument2Close,14,1)[0] ;
    Value[0] = rsi1[0] - rsi2[0] ;

    ​}


    Click image for larger version

Name:	image.png
Views:	98
Size:	13.0 KB
ID:	1329985


    #2
    Can anyone help me out with above issue?
    much appreciated !!

    Comment


      #3
      Hello,

      Thank you for your inquiry.

      If the indicator isn't plotting as expected, I recommend debugging using prints.

      To understand why the script is behaving as it is, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

      Add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition.

      The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

      The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

      I am happy to assist you with analyzing the output from the output window.

      Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

      https://support.ninjatrader.com/s/ar...nd-TraceOrders

      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