This code looks like it should work to me according to the manual and the tutorials, but when I add the RSI[1] the graph is blank. If I remark that out, then the RSI[0] works just fine. I've tried porting the values to the output window, but when I include RSI[1] I get the following output regardless of the RSI value...
The current RSI value is 1.3983
Error on calling 'OnBarUpdate' method for indicator 'PrintRSI' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
Again, if I remove RSI[1] then the value of RSI[0] prints fine. Here is the code I am trying to get to work:
/// Just debug code here Print ("RSI currently is " + RSI(Close, 2, 3)[0]); Print ("RSI 1 currently is " + RSI(Close, 2, 3)[1]); if (RSI(Close, 2, 3)[1] <= 1) && RSI(Close, 2, 3)[0] >= 30) { PlotHigh.Set(1); PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Connected.wav"); } if (RSI(Close, 2, 3)[1] >= 99) && RSI(Close, 2, 3)[0] <=70) { PlotLow.Set(1); PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Connected.wav"); }
Comment