TradingView
Stable_Camel
Nov 20, 2015 7:09 PM

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

SPDR S&P 500 ETF TRUSTArca

描述

"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
评论
B120626
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.
ChartArt
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:

tradingview.com/script/IGJPEi7L-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.
Stable_Camel
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.
Stable_Camel
Btw, what settings did you use for your strategy in that backtest? I'm unable to replicate it.
ChartArt
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.
Stable_Camel
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): tradingview.com/chart/Sf8QfgU5/
Stable_Camel
Here's TLT (20+ years Treasurys): tradingview.com/chart/pxULPCP9/
Stable_Camel
Stable_Camel
Stable_Camel
GDX (large gold miners): tradingview.com/chart/AC1cN5bR/
更多