Refrencing Daily candle in a 5 minute bot
Created at 27 Dec 2020, 12:13
AN
Refrencing Daily candle in a 5 minute bot
27 Dec 2020, 12:13
How do I reference the previous days candle on a cBot???
Right now i have
private Bars daily;
daily = MarketData.GetBars(TimeFrame.Daily);
double yHigh = daily.HighPrices.Last(1);
I expect this to give me the last days high price, instead...I get this.
26/11/2020 00:00:00.000 | Backtesting started
26/11/2020 00:00:00.000 | Crashed in OnStart with NullReferenceException: Object reference not set to an instance of an object.
26/11/2020 00:00:00.000 | Backtesting was stopped
I also tried
double yHigh = daily.HighPrices.Last(daily.Count - 1);
To see if maybe I was referencing the wrong side of the array, but it still crashes.
Whats the issue here?
Please help me reference the previous day candle within my 5 Minute bot.
Replies
PanagiotisCharalampous
28 Dec 2020, 09:49
Hi analogpermutations,
Please provide the complete cBot code, cBot parameters and steps to reproduce the problem.
Best Regards,
Panagiotis
@PanagiotisCharalampous
analogpermutations
28 Dec 2020, 00:24 ( Updated at: 28 Dec 2020, 00:25 )
I cant believe nobody knows how to do this??
Like why does it seem like it should be so simple, yet isn't.
Ive now tried this as well.
Still get this error
WHY!!??
@analogpermutations