When I try to run the Algo, the typical error pops up: "Object reference not set to an instance of an object"
Posting here, just in case anyone in the forum might indicate what I'm doing wrong initializing the Class Trendline.
Thanks a lot!
namespace NinjaTrader.Strategy
{
[Description("vvv")]
public class Trendline
{
public int position;
public double rate;
public Trendline()
{
position = 0;
rate = 0.00;
}
}
public class VVV : Strategy
{
#region Variables
private Trendline[] uptrend = new Trendline[1];
private Trendline[] downtrend = new Trendline[1];
#endregion
protected override void Initialize()
{
Do stuff
}
protected override void OnStartUp()
{
uptrend = new Trendline[activedays + 1];
downtrend = new Trendline[activedays + 1];
}
protected override void OnBarUpdate()
{
if ( CurrentBar < 1 )
{
for (int i = 0; i < activedays; i++)
{
uptrend[i] = new Trendline();
downtrend[i] = new Trendline();
}
for (int i = 0; i < activedays; i++)
{
uptrend[i].position = 0;
uptrend[i].rate = 0.00;
downtrend[i].position = 0;
downtrend[i].rate = 0.00;
}
}

Comment