I have a strategy class called VWAPBounceStrategy, in which the buys and sells are signaled by self.longs, self.shorts, self.longXs, and self.shortXs, which are outputs of a method called vwapbounce_signal.
I would like to implement walkforward analysis on this strategy. I looked at the ML notebook and some conversations on updating the optimal parameters. Here's a basic implementation. I would like to ask if this looks right, or is there something else needed. The workflow is retraining every month. This code does run.
I have a strategy class called VWAPBounceStrategy, in which the buys and sells are signaled by self.longs, self.shorts, self.longXs, and self.shortXs, which are outputs of a method called vwapbounce_signal.
I would like to implement walkforward analysis on this strategy. I looked at the ML notebook and some conversations on updating the optimal parameters. Here's a basic implementation. I would like to ask if this looks right, or is there something else needed. The workflow is retraining every month. This code does run.
` class VWAPWalkForwardStrategy(VWAPBounceStrategy): def next(self): month = ( pd.Series(pd.DatetimeIndex(self.data.df.index).month) .diff() .abs().gt(0) .cumsum() .fillna(0) )