isOnDailyChart = Bars.Period.Id == PeriodType.Day && Bars.Period.Value == 1;
symbol = Instrument.MasterInstrument.Name;
to access timeframe and symbol information. However each time in NT Log window I get an error message:
Failed to call method "Initialize" for indicator 'Test': Object reference not set to an instance of an object.
Although this error message seems not affecting the correct running of my indicator, there may be a lot such error message when I swtich timeframe and symbol frequently, which is quite annoying.
My question is whether I should access the member variables of Bars and Instrument? Why does my indicator work fine with such error message?
What is the correct way to access time frame and instrument information within Initialize() function?
Comment