I've been working with some posts to implement capturing the time and price under a mouse click. That much works. However, in the indicator, when I access values of either Time[] or High[] more than a few bars back, I get an object reference error. I'm testing it on a simple 3-min chart with only one data series. It's got to be something pretty basic that I'm missing, but I'm at a loss as to why I could not use the arrays as I normally would or at least had been used to using them in NT7. I've attached the indicator in case anyone spots that something obvious. Meanwhile, the output shows that there are 3,706 bars on the chart, but an error gets thrown when trying to retrieve the value of Time[8]. In addition, the values for time for the first few that are returned are all incorrect.
Number of bars on chart: 3706
Time test 0: 11/13/2019 6:03:00 PM
Time test 1: 11/13/2019 4:43:00 PM
Time test 2: 11/13/2019 4:43:00 PM
Time test 3: 11/13/2019 4:43:00 PM
Time test 4: 11/13/2019 4:43:00 PM
Time test 5: 11/13/2019 4:43:00 PM
Time test 6: 11/13/2019 4:43:00 PM
Time test 7: 11/13/2019 4:42:00 PM
Time test didn't work: Object reference not set to an instance of an object.
The first line outputs the value of Time[0] - which I had thought was the barsAgo value from the last bar on the chart. But the output is the date/time of the very first bar on the chart. Is there something about working with NT8 that I just fundamentally don't understand? Thanks.
Regards,
Gordon
Comment