Koi_Capital

"SPY Master" Long/Short Swing Trading Algorithm Beats S&P 500!

AMEX:SPY   SPDR S&P 500 ETF
"SPY Master" is a simple medium frequency trading algorithm that uses my RSI-EMA oscillator on a 1h chart to trigger buy/cover and sell/short signals. The algorithm only holds 1 position each time and it can go either long or short on SPY             ( S&P 500             exchange-traded fund). The average holding period per trade is about 18 hours.

Please note that the backtest uses a fixed size of $10,000 for each trade so there is no reinvestment or compounding.

Commissions aren't factored into the backtest but there are 294 trades (588 orders) total so assuming $1 commission per order, that's $588. That's about how much I pay to make a $10,000 trade with SPY             at Interactive Brokers. Dividends are also not factored into the backtest but SPY             typically yields about 2% a year in dividends.

The idea behind this strategy follows the premise that most profitable momentum trades usually occur during periods when price is trending up or down. Periods of flat price actions are usually where most unprofitable trades occur. Because we cannot predict exactly when trending periods will occur, the algorithm basically bets money on all trade opportunities during all market conditions. However, the way it's designed also allows it to keep the losers small and let the winners run. The algorithm only wins about 40% of the time but its average winner is 2.6 times the average loser.

----------------------------------------
ALGORITHM SETTINGS:

Chart interval = 1h
Buy/Cover = EMA2(RSI5) cross> 50
Sell/Short = EMA10(RSI5) cross< 50

----------------------------------------
BACKTEST SETTINGS:

- Period = Jan 2013 - Present
- Short-selling enabled
- Dividends disabled
- Trading cost disabled
- Reinvestment disabled
- Initial cash = $10,000
- Fixed trade size = $10,000

----------------------------------------
BACKTEST PERFORMANCE:

SPY             (benchmark)
- Net return = +41%
- CAGR = 13%
- Max drawdown = -22%
- CAGR/Max DD             = 0.6

Algorithm (long/short):
- Net return = +61%
- CAGR = 18%
- Max drawdown = -10%
- CAGR/Max DD             = 1.8

Related Ideas

B120626
a year ago
winners bigger than losers. that is the way to do it.
thanks for taking the time to include a nice explanation of what it does and how it works.
+1 Reply
ChartArt
a year ago
First thank you for sharing your strategy, I know how difficult it is to develop good strategies so you have all my respect.

I had posted a RSI (plus Stochastic) strategy on Tradingview, which has a much higher performance on the 1 hour chart with a profit factor of almost 9, but it suffers from the same issue as your strategy. It only works on the S&P 500 (and recent trades were bad). Here is mine:

Stochastic + RSI, Double Strategy (by ChartArt)


I have backtested your strategy script on other indices and just as my strategy it fails on them:

NAS100
UK100
UKOIL / USOIL
GLD

I could have tested much more, but that was enough to find the usual weakness, which I wanted to alert you about.
Reply
Koi_Capital PRO ChartArt
a year ago
Hi. Thanks for sharing, that's a cool strategy! My strategy and the settings posted here are not intended as a one size fits all solution. Different asset classes and time frames have different technical characteristics and require different input assumptions as a result. You would need to recalibrate the indicator for different securities and chart intervals.
Reply
Koi_Capital PRO ChartArt
a year ago
Btw, what settings did you use for your strategy in that backtest? I'm unable to replicate it.
Reply
ChartArt Koi_Capital
a year ago
The market behaved so badly bullish volatile against my RSI, Stochastic combo that it turned the profit factor in the last 28 days from a factor of 8.97 down to 3.91 and the percent profitable from 70.97% down to 67.14% in this recent span of time.

I noticed I lost four followers this month, around the number which I gained when I had freshly published this script. Bad time for the default setting of this strategy script this month. Shit happens. Never trust backtest data alone.
Reply
Koi_Capital PRO ChartArt
a year ago
My strategy seems pretty consistent among certain other asset classes, as long as you re-calibrate the indicator. Here's the strategy for HYG (junk bonds): https://www.tradingview.com/chart/Sf8QfgU5/
Reply
Koi_Capital PRO ChartArt
a year ago
Here's TLT (20+ years Treasurys): https://www.tradingview.com/chart/pxULPCP9/
Reply
Koi_Capital PRO ChartArt
a year ago
QQQ (Nasdaq 100): https://www.tradingview.com/chart/o5XoFcPC/
Reply
Koi_Capital PRO ChartArt
a year ago
USO (crude oil): https://www.tradingview.com/chart/2d1doZea/
Reply
Koi_Capital PRO ChartArt
a year ago
GDX (large gold miners): https://www.tradingview.com/chart/AC1cN5bR/
Reply
Koi_Capital PRO ChartArt
a year ago
VXX (VIX) and XIV (inverse VIX):
https://www.tradingview.com/chart/PfCIClAO/
https://www.tradingview.com/chart/33uEQ0nu/
Reply
Koi_Capital PRO ChartArt
a year ago
Forex (EURUSD): https://www.tradingview.com/chart/93PJ3ctA/
Reply
Koi_Capital PRO ChartArt
a year ago
BOND: https://www.tradingview.com/chart/VxoYa3El/
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out