This chart shows RSI average values that are not the same as the Data Box's RSI average values. I thought the index [1], etc would pull the correct values but it is not. Is the syntax incorrect somewhere in the code? See chart in attached.
Thanks in advance!
namespace NinjaTrader.Strategy
{
public class ShowRSIvalue : Strategy
{
#region Variables
private DataSeries rsi;
private DataSeries avg;
#endregion
protected override void Initialize()
{
CalculateOnBarClose = false;
Add(RSI(9,3));
rsi = new DataSeries(this);
avg = new DataSeries(this);
}
protected override void OnBarUpdate()
{
rsi.Set(Math.Round((RSI(9,3)[0]),2));
avg.Set(Math.Round((RSI(9,3)[1]),2));
DrawTextFixed("RSI", "RSI 0: " + rsi[0] + " " + avg[0]
+ "\nRSI 1: " + rsi[1] + " " + avg[1]
+ "\nRSI 2: " + rsi[2] + " " + avg[2]
+ "\nRSI 3: " + rsi[3] + " " + avg[3]
+ "\nRSI 4: " + rsi[4] + " " + avg[4]
+ "\nRSI 5: " + rsi[5] + " " + avg[5]
,TextPosition.Center,Color.Yellow,new Font("Arial",18),Color.Black,Color.Black,10);
}

Comment