I am new to Ninja Trader migrating from Tradestation. I am currently converting some code with some success. My programming skills are rudimentary, certainly not great.
I am currently bumping up against some walls in using DataSeries and was hoping someone with greater experience could lend a hand.
Summary:
I am trying to compare values of a data series by referencing the variable and then using the brackets to specify the historical bar.
Example:
if (RSIWeightedAverage[0] < RSI RSIWeightedAverage[1]) &&
(RSIWeightedAverage[1] < RSI RSIWeightedAverage[2])
{
Print("RSIWAvg is falling.");
}
Problem:
Prior to adding this statement or any statement that references historical bars, I am able to print out the values correctly. The problem is that once I try and reference any historical value, it DOES compile, but the value is way off. It is no longer between 1 and 100 and all of my variables equal each other...in this case 825.6.
Example:
In summary, I am able to get the value for this:
RSIWAvg.Set(WMA(_RSI,13)[0]);
Print("WRSI is: " + RSIWAvg);
This prints the number: 36.69 (a valid RSI #)
but get a false value (again, it compiles) for this:
RSIWAvg.Set(WMA(_RSI,13)[0]);
Print("WRSI is: " + RSIWAvg[3]);
This prints the number: 826.6 and all other variables print the same number. (not a valid RSI value)
Any help is greatly appreciated.
Nick
Comment