QuantRocket

Segmented Backtests in Moonshot


#1

I am backtesting a low volatility stock strategy in Moonshot using Sharadar prices. To calculate volatility I use the previous 252 days of daily returns. If I run the backtest in one go it works fine, for ex. from 2010 to 2018. But if I run the same exact code but using the segment = ‘A’ option, then i get very different results and long stretches of time where there are no positions in the portfolio. I am guessing that with segmented backtests the only price data that is fed in is for the current segment and not prior to that? So for the 2012 segment, data would go from 1/1/2012 to 12/31/2012? Is there a way of running a segmented backtest but include data for the year prior to the segment or something similar?


#2

Are you familiar with how lookback windows work? Should default to 252 but maybe you have a *_WINDOW parameter overriding it?

https://www.quantrocket.com/docs/#moonshot-lookback-windows


#3

Yeah the only *_WINDOW I had was the dollar volume window that’s in the examples set at 90. The other parameter was hard coded in the strategy. Changed it to 252 and it worked.

Thanks for the help.