# Overnight Bot This strategy was taken from chapter 7 of [Short Term Trading Strategies That Work](https://moshferatu.dev/moshferatu/short-term-trading-strategies-that-work) (2008) by Larry Connors. ## Rules 1. Go long SPY on the close. 2. Sell on the following open. It is not possible to enter positions on the close of a bar in NinjaScript. The strategy works around this by incorporating a 1-minute data series and entering on the open of the last bar each day. The position is exited on the open of the following day as expected. ## Parameters **Use Trend Filter**: Whether to use a trend filter to decide when to enter long positions. (Default: false) **Long Term Trend Period**: The period of the trend filter as measured using a simple moving average. (Default: 200) ## Backtest Results The backtests in the book ranged from 1995-2007. The 1-minute data from my data provider necessary for this strategy currently only goes back to 2007. ### SPY ![SPY Analysis](./backtest-results/spy_analysis.png) ![SPY Summary](./backtest-results/spy_summary.png) #### 200-Day Trend Filter ![SPY Trend Filter Analysis](./backtest-results/spy_trend_filter_analysis.png) ![SPY Trend Filter Summary](./backtest-results/spy_trend_filter_summary.png) ### QQQ ![QQQ Analysis](./backtest-results/qqq_analysis.png) ![QQQ Summary](./backtest-results/qqq_summary.png) #### 200-Day Trend Filter ![QQQ Trend Filter Analysis](./backtest-results/qqq_trend_filter_analysis.png) ![QQQ Trend Filter Summary](./backtest-results/qqq_trend_filter_summary.png) ---