Hello sir, thank you in advance!! I have been struggling with live trading with IB, in my other topic you have provided a great solution on backfilling only regular trading hours' data feeds by set useRTH=Ture.
However, some new question pops out I feel it's hard to solve. Ideally, my program will run 24/7 on VPS, with live-1min-bar being feed to next(). Even with useRTH=True, next() still getting live data that outside RTH.
By the nature of bt indicators, say SMA, it is calculated on time window from data to data[-n], which rely on a well-formatted data.
My target is to have the datafeeds only contains RTH data(3:59 day1 connected to 9:30 day2 for US stocks), in such case the indicators do not mass up by non-trading-hours' data.
Is there any way I could formate such data from live data feeds? Even with the custom code needed, which approaches you to recommend me to go for, would work better with your package? (1. make the indicator "smarter", so they know non-trading hours' data should be ignored. 2, formate the live data feeds, if it's outside RTH, do not pass to next(). 3. If a non-trading hour bar has been pass to next, use some function to delete that bar in datafeeds, so the data[-1] still inside RTH. 4. Pause the program when the time is outside RTH(might need some good control for such pause) )