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] ;
}

Comment