2024-09-03 12:47:54 +00:00
# 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.
2024-09-03 13:29:46 +00:00
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.
2024-09-03 13:27:31 +00:00
The position is exited on the open of the following day as expected.
2024-09-03 13:13:28 +00:00
## 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)
2024-09-03 13:21:45 +00:00
## Backtest Results
The backtests in the book ranged from 1995-2007.
2024-09-03 13:33:29 +00:00
The 1-minute data from my data provider necessary for this strategy currently only goes back to 2007.
2024-09-03 13:21:45 +00:00
### SPY
2024-09-23 15:06:50 +00:00
![SPY Analysis ](https://static.moshington.com/images/strategies/overnight/spy-analysis.png )
2024-09-03 13:21:45 +00:00
2024-09-23 15:06:50 +00:00
![SPY Summary ](https://static.moshington.com/images/strategies/overnight/spy-summary.png )
2024-09-03 13:21:45 +00:00
2024-09-03 14:37:04 +00:00
#### 200-Day Trend Filter
2024-09-23 15:06:50 +00:00
![SPY Trend Filter Analysis ](https://static.moshington.com/images/strategies/overnight/spy-trend-filter-analysis.png )
2024-09-03 14:37:04 +00:00
2024-09-23 15:06:50 +00:00
![SPY Trend Filter Summary ](https://static.moshington.com/images/strategies/overnight/spy-trend-filter-summary.png )
2024-09-03 14:37:04 +00:00
2024-09-03 14:32:42 +00:00
### QQQ
2024-09-23 15:06:50 +00:00
![QQQ Analysis ](https://static.moshington.com/images/strategies/overnight/qqq-analysis.png )
2024-09-03 14:32:42 +00:00
2024-09-23 15:06:50 +00:00
![QQQ Summary ](https://static.moshington.com/images/strategies/overnight/qqq-summary.png )
2024-09-03 14:32:42 +00:00
2024-09-03 14:41:33 +00:00
#### 200-Day Trend Filter
2024-09-23 15:06:50 +00:00
![QQQ Trend Filter Analysis ](https://static.moshington.com/images/strategies/overnight/qqq-trend-filter-analysis.png )
2024-09-03 14:41:33 +00:00
2024-09-23 15:06:50 +00:00
![QQQ Trend Filter Summary ](https://static.moshington.com/images/strategies/overnight/qqq-trend-filter-summary.png )
2024-09-03 14:41:33 +00:00
2024-09-03 12:47:54 +00:00
---