SPY 200SMA +4% Entry -3% Exit TQQQ/QLD/GLDM THREE PHASE STRATEGY by freefighter07
By freefighter07
Performance Metrics
- Author: freefighter07
- Symbol: AMEX:SPY
- Timeframe: 1 day
- Net P&L: +20,919,728.37 USD (+1,799.49%)
- Win Rate: 100.0%
- Max Drawdown: 1,134,491.52 USD (8.43%)
- Total Trades: 12
Description
Wanted to take a look at all of the individual trades and provide a series of options to balance performance and risk. This post is expanding on my previous one - reddit.com/r/LETFs/comments/1nhye66/spy_200sma_43_tqqqqqq_long_term_investment/Here is the data and the backtesting splitting the strategy into three primary phases with multiple options and exact trade dates to help people easily backtest other combinations - docs.google.com/spreadsheets/d/1GrPd4-953XkMfDJnkOaDFuRfRWy9N6CzV7f3LqYapu0/edit?usp=sharing (Three Tabs with the three phases)If you just want my personal recommendations this would be what I will be using -PHASE 1 (Strategy BUY signal triggers when SPY price crosses +4% over the SPY 200SMA) = 100% TQQQIf trade lasts 366 days (Long Term Cap Gains) go to PHASE 2If SPY price crosses below -3% SPY 200SMA go to PHASE 3PHASE 2 (PHASE 1 lasts 366 days) = Deleverage and diversify into 50% QLD & 50% GLDMPHASE 3 (Strategy SELL signal triggers when SPY price crosses -3% below the SPY 200SMA) = Defensive posture with 50% SGOV & 50% GLDMAs market degrades start selling SGOV and buying QQQ until 50% QQQ & 50% GLDMTradingView Script for the THREE PHASE STRATEGY (imgur.com/a/5vvyU93):Pine Script®//@version=5strategy("SPY 200SMA +4% Entry -3% Exit Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)// === Inputs ===smaLength = input.int(200, title="SMA Period", minval=1)entryThreshold = input.float(0.04, title="Entry Threshold (%)", step=0.01)exitThreshold = input.float(0.03, title="Exit Threshold (%)", step=0.01)startYear = input.int(1995, "Start Year")startMonth = input.int(1, "Start Month")startDay = input.int(1, "Start Day")// === Time filter ===startTime = timestamp(startYear, startMonth, startDay, 0, 0)isAfterStart = time >= startTime// === Calculations ===sma200 = ta.sma(close, smaLength)upperThreshold = sma200 * (1 + entryThreshold)lowerThreshold = sma200 * (1 - exitThreshold)// === Strategy Logic ===enterLong = close > upperThresholdexitLong = close 0 strategy.close("Buy")// === 366-Day Marker Logic (Uninterrupted) ===var int targetTime = na// 1. Capture entry time only when a brand new position startsif strategy.position_size > 0 and strategy.position_size[1] == 0 targetTime := time + (366 * 24 * 60 * 60 * 1000)// 2. IMPORTANT: If position is closed or a sell signal hits, reset the timer to "na"if strategy.position_size == 0 targetTime := na// 3. Trigger only if we are still in the trade and hit the timestampisAnniversary = not na(targetTime) and time >= targetTime and time[1] 0 and strategy.position_size[1] == 0newClose = strategy.position_size == 0 and strategy.position_size[1] > 0if newOpen label.new(x=bar_index, y=low * 0.97, text="BUY - PHASE 1", xloc=xloc.bar_index, yloc=yloc.price, color=color.lime, style=label.style_label_up, textcolor=color.black, size=size.small)if newClose label.new(x=bar_index, y=high * 1.03, text="SELL - PHASE 3", xloc=xloc.bar_index, yloc=yloc.price, color=color.red, style=label.style_label_down, textcolor=color.white, size=size.small)Expand 81 lines200 SMA SPY Trading Range Bands Script:Pine Script®//@version=5indicator("200 SMA SPY Trading Range Bands", overlay=true)// === Settings ===smaLength = input.int(200, title="SMA Length")mult1 = input.float(1.09, title="Multiplier 1 (9% Over)")mult2 = input.float(1.15, title="Multiplier 2 (15% Over)")// === Calculations ===smaValue = ta.sma(close, smaLength)line9Over = smaValue * mult1line15Over = smaValue * mult2// === Plotting ===plot(smaValue, title="200 SMA", color=color.gray, linewidth=1, style=plot.style_linebr)plot(line9Over, title="9% Over 200 SMA", color=color.rgb(255, 145, 0), linewidth=1)plot(line15Over, title="15% Over 200 SMA", color=color.rgb(38, 1, 1), linewidth=2)Expand 17 lines