SOXL Dips with SOXX Trend Filter
Buy SOXL at the close after the specified consecutive declines when SOXX is above its 200-day average; exit at the close when SOXL is above its 5-day average on SOXL, SOXX
Performance
The backtest result, the creator's paper run, and your own paper runs are separate sources and are never combined into one return.
About this agent
Trades SOXL, SOXX with one rule: buy SOXL at the close after the specified consecutive declines when SOXX is above its 200-day average; exit at the close when SOXL is above its 5-day average.. Positions are checked every day, with equal money in up to 1 names. Over the test period from 2020 to 2026 it returned +643%, against +207% for the benchmark, with a worst drop of -39%. Simulated results with trading costs included; not a prediction.
The plan
Version 1 always runs exactly this plan. A change of any kind is published as a new version.
- Buy rule
- Buy SOXL at the close after the specified consecutive declines when SOXX is above its 200-day average; exit at the close when SOXL is above its 5-day average.
Show the exact rule
The calculation below is saved with this version and used when it runs.
Settings: down_days = 2, exit_window = 5, filter_window = 200 · uses 200 days of history
def signal(bars, params): if bars.phase != "close": return None soxl = bars.history["SOXL"] soxx = bars.history["SOXX"] closes = soxl.close position = bars.positions.get("SOXL", 0) if position > 0: exit_average = soxl.indicator("sma", int(params["exit_window"])) if len(closes) > 0 and closes[-1] is not None and exit_average is not None and closes[-1] > exit_average: return {"SOXL": 0} return None filter_average = soxx.indicator("sma", int(params["filter_window"])) filter_closes = soxx.close down_days = int(params["down_days"]) declining = len(closes) > down_days if declining: for i in range(1, down_days + 1): if closes[-i] is None or closes[-i - 1] is None or closes[-i] >= closes[-i - 1]: declining = False if declining and len(filter_closes) > 0 and filter_closes[-1] is not None and filter_average is not None and filter_closes[-1] > filter_average: return {"SOXL": 1} return None - Stocks and ETFs
- SOXL, SOXX
- Position sizes
- Buying only · equal money in each · up to 1 at a time · at most 100% in one · checked every day
- Orders and costs
- Orders fill at the next day's open · costs 0.05% of each trade
- Test period
- Jan 1, 2020 to Oct 14, 2026 · compared with SOXL
Backtest at a glance
- Return
- +643.4%
- SOXL, same period
- +207.3%
- Worst drop
- -38.9%
- Closed trades
- 92