@vladisld Thank for your reply, I have some question about your solution, would you please clarify it for me? Thanks for you time.
- If add all the asset (which could be 4000+) to the strategy, how to make other data feed inactive, and don't need to load them and process them? Otherwise it will be very bad for performance and memory.
- Once stratgey start to run, if I want to change some asset, how to make the new selected asset active?
- Could I initize the indicator with new data feed in the strategy.next() function, then start to use these indicator? for example:
class UserStockStrategy(bt.Strategy): def next(self): if time_is_right == True: new_asset_idx = self.pick_some_asset() self.sma = SMA(self.datas[new_asset_idx], period=5) if self.sma > self.datas[new_asset_idx].close: self.buy()