Thanks Dasch for your comprehensive reply.
The issue that I am seeing is an incorrect final delayed bar, where it is formed before the time period is over.
Using the below screenshot as an example, GBPUSD closing price of 1.28984 at 8:05:00 is incorrect as it shows GBPUSD's closing price at the time of connection instead of at 08:05:00
Is it just me facing this problem or this data point got overlooked by others?
Creating my own data filter/feed could be an option but I just find it incredible how users could live/paper trade with this incorrect data point.
Code is attached below for reference.
import backtrader as bt
import datetime as dt
import pytz as pytz
class Test_Strategy (bt.Strategy):
def next (self):
self.log (self.data.close[0])
def notify_data(self, data, status):
print('*' * 5, 'DATA NOTIF:', data._getstatusname(status))
def log (self, text):
print (self.data.datetime.datetime(0),": ", text)
if __name__ == '__main__':
ibstore = bt.stores.IBStore (host = '127.0.0.1', clientId = 110, port = 7497)
data = ibstore.getdata (dataname = 'GBP.USD-CASH-IDEALPRO', #GBP.USD-CASH-IDEALPRO, BARC-STK-LSE-GBP
rtbar = False,
tz=pytz.timezone('US/Eastern'),
)
cerebro = bt.Cerebro()
cerebro.broker = ibstore.getbroker() ###
cerebro.resampledata (data, timeframe = bt.TimeFrame.Minutes, compression = 5, rightedge = True, boundoff = 0)
cerebro.addstrategy (Test_Strategy)
cerebro.run()