I've been working on a strategy, that works fine when it starts on a chart with no bars, but won't work at all on a chart with bars. So if it starts blank it will run through, it's doing some weird things though its not drawing etc after it enters the trade.
I get this error when I run it on a chart with bars.
'Bars' property can't be accessed from within 'Initialize' method.
Even if I comment out all items in the Initialize() area. The only things I have in Initialize are strategy settings, CalculateOnBarClose = False etc.
protected override void Initialize()
{
SetProfitTarget("",Calculationmode.Ticks, pt);
this.CalculateOnBarClose = false;
this.EntriesPerDirection = 10;
this.EntryHandling = EntryHandling.UniqueEntries;
this.ExitOnClose = false;
this.DefaultQuantity = 1;
}
If I comment out all the lines it still gets the same error. What in the OnBarUpdate would cause such an error?
Comment