We are using NT 8.0.20.1 64-bit. Testing on a 1 minute chart bar.
We have an indicator that receives data from backend. We then use TriggerCustomEvent() to call a method which processes then plots those data. When the data is processed, we use datetime values from _CurrentBar, _CurrentBar - 1, _CurrentBar -2 -- stored in vars Time0, Time1, Time2 -- to determine if we plot on current bar or previous bar. If not on current bar or previous bar, we loop thru Time series to figure out which bar it belongs to.
So sometimes nothing gets plotted resulting in gaps on data plotted. Based on the logs from the Print() statements added on method called by TriggerCustomEvent(), somehow the OnBarUpdate() doesn't get called resulting in datetime's (using Time.GetValueAt) for CurrentBar, _CurrentBar and Time0, Time1, Time2 to still have an old datetime value, and so these new data aren't in the range of Time0,Time1,Time2 and so we have to go thru Time series, and if not there then it nothing gets plotted for that bar.
OnBarUpdate() is light. Returns if CurrentBar is < 1, else sets those datetime vars. It has other code that runs when State is Historical.
Sample logs:
(data received by indicator are just processed ticks and comes from the same datafeed provider used to display realtime data on NT.)
Expected:
time0: 2020/03/16 22:05:00.0000
time1: 2020/03/16 22:04:00.0000
time2: 2020/03/16 22:03:00.0000
time3: 2020/03/16 22:02:00.0000
TRUE = 2020/03/16 22:04:00.0000<= 2020/03/16 22:04:50.7160 <= 2020/03/16 22:05:00.0000 // match current bar, data.timestamp >= time1 and data.timestamp <= time0
FALSE = 2020/03/16 22:03:00.0000<= 2020/03/16 22:04:50.7160 <= 2020/03/16 22:04:00.0000 // match previous bar, data.timestamp >= time2 and data.timestamp <= time1
_CurrentBar Tick Timestamp: 2020/03/16 22:05:00.0000
CurrentBar Tick Timestamp: 2020/03/16 22:05:00.0000
Last OnBarUpdate(): 2020/03/16 22:04:52.0330
Not expected:
time0: 2020/03/16 22:51:00.0000
time1: 2020/03/16 22:50:00.0000
time2: 2020/03/16 22:49:00.0000
time3: 2020/03/16 22:48:00.0000
FALSE = 2020/03/16 22:50:00.0000<= 2020/03/16 22:54:01.2320 <= 2020/03/16 22:51:00.0000
FALSE = 2020/03/16 22:49:00.0000<= 2020/03/16 22:54:01.2320 <= 2020/03/16 22:50:00.0000
(2020/03/16 22:54:01.2320) does not match with current bar (2020/03/16 22:51:00.0000) nor with previous bar (2020/03/16 22:50:00.0000)
(2020/03/16 22:54:01.2320) matched with barOpen (2020/03/16 22:55:00.0000)
Done search attempt for bar where tick timestamp (2020/03/16 22:54:01.2320) belongs to.
barsAgo: 5786
barTickTimestamp: 2020/03/16 22:55:00.0000
_CurrentBar Tick Timestamp: 2020/03/16 22:51:00.0000
CurrentBar Tick Timestamp: 2020/03/16 22:51:00.0000
Last OnBarUpdate(): 2020/03/16 22:50:49.1010 <---- last time OnBarUpdate() got called
Above, it does seem to find the bar when looping thru Time series but I'm still curious as to why OnBarUpdate() sometimes don't get called. Is there a condition that our indicator reaches and that somehow causes OnbarUpate() to not get called?
Thanks.

Comment