When Both Thursdays And Fridays Are Down In SPY
Last Updated on November 21, 2020 by Oddmund Groette
Here is the strategy:
- Today is Friday.
- Yesterday (Thursday) was down more than -0.15% and today also more than -0.15%. 0.15% is used to have some wiggle room because you have to send the orders before the market closes.
- Exit after two days on the close (usually on Tuesdays).
The test period is from 2005 until February 2013:
P/L | #Fills | Avg. | |
47.93 | 62.00 | 0.77 |
Here is the equity curve:
Doing the opposite (and short) we get this equity curve:
It does not work on other days. On Wednesdays, it pays off to go short.
Hi,
Here’s a small script that replicates your strategy in R (http://www.r-project.org):
install.packages(c(“quantmod”, “lubridate”))
library(quantmod)
library(lubridate)
posSize <- 5000 # per trade
txnFees <- 0.02 # per share
# Get data from Yahoo Finance
x <- getSymbols("SPY", from = "2005-01-01", auto.assign = FALSE)
# Adjust OHLC and subset data from 2005-01-01 to 2013-02-28
x <- adjustOHLC(x["2005::2013-02"], use.Adjusted = TRUE)
# Signal: if Friday and last two close to close were down
x$Wday <- wday(index(x))
x$Sig <- ifelse(x$Wday == 6 & Cl(x) < Lag(Cl(x)) & Lag(Cl(x)) < Lag(Cl(x), 2), 1, 0)
# Entry price: close price of sig day
x$EntryPrice <- as.numeric(Cl(x))
# Exit price: close price 2 days later
x$ExitPrice <- c(as.numeric(Cl(x))[-c(1:2)], rep(NA, 2))
# Number of shares
x$Shares <- floor(posSize/x$EntryPrice)
# Calculate PnL including txn fees
x$PnL <- x$Sig * x$Shares * (x$ExitPrice – x$EntryPrice – 2 * txnFees)
x[is.na(x)] <- 0
plot(cumsum(x$PnL/posSize))