___________ __ ___________ .__ .__ .__
\__ ___/______ ____ ____/ |_ \_ _____/____ | | | | ______ _ _|__| ____ ____
| | \_ __ \_/ __ \ / \ __\| __)/ _ \ | | | | / _ \ \/ \/ / |/ \ / ___\
| | | | \/\ ___/| | \ | | \( <_> )| |_| |_( <_> ) /| | | \/ /_/ >
|____| |__| \___ >___| /__| \___ / \____/ |____/____/\____/ \/\_/ |__|___| /\___ /
\/ \/ \/ \//_____/
A systematic exploration of 40+ trend-following strategies, documenting the journey from -93% to +40% through iterative learning and optimization.
New to this repository? Start with docs/START_HERE.md for a guided introduction, or dive directly into DISCOVERIES_AND_LEARNINGS.md for comprehensive results from 293 validated backtests. Basket traders should make a beeline for the new βBasket Trading Playbook (Options Baskets)β section, and analytic-minded readers can review the fresh βSegmented logistic drill-downβ insights generated from the Python pipeline.
What works on SPY often fails elsewhere. After testing 14 strategies across 21 securities (11 stocks + 10 ETFs), the data reveals that asset characteristics matter more than strategy sophistication. The same strategy can be the best performer on one security and catastrophic on another.
-
Alt10 (Profit Targets) - 76.19% success rate (16/21 profitable)
- Explicit 3N-6N-9N profit taking = predictable 3-10 week holds
- Works on BOTH stocks AND ETFs (rare!)
- Best for: Healthcare (UNH +33.1%, XLV +27.7%), broad market (SPY +20.3%, QQQ +22.8%)
-
Alt45 (Dual-Momentum) - 66.67% success rate (14/21 profitable)
- 2nd most consistent strategy overall
- QQQ +29.23%, CAT +28.62%, UNH +27.07%
- Best for: Growth stocks with strong momentum
-
Alt26 (Fractional Pyramid) - 57.14% success rate (12/21 profitable)
- Best SPY performer (+33.50% validated)
- Lowest drawdowns (MSFT 4.98%, WMT 5.96%)
- Scale-out exits (100%β75%β50%β25%)
- Healthcare: 12/13 strategies profitable (92% success) - TRADE THIS
- Technology: 8/10 strategies profitable (80% success) - TRADE THIS
- Utilities: 0/14 strategies profitable (0% success) - AVOID COMPLETELY
- Energy: 2/10 strategies profitable (20% success) - AVOID
Full sector-by-sector play-calling lives in the Basket Trading Playbook and the detailed sector recommendation matrix.
- Segmentation confirms the story: The
analysis-outputs/statistical_outputs/segmented_models/logistic regressions reinforce healthcare/tech tailwinds, highlight the stock vs ETF edge, and flag Energy/Utilities as statistically hostile. See the breakdown in DISCOVERIES_AND_LEARNINGS.md β Segmented logistic drill-down. - Basket-ready roster: The newest Basket Trading Playbook maps every sector sleeve to its Pine Script, backup, and hard βdo not tradeβ calls so options baskets stay aligned with the data.
- Best ETF Result: XLV Alt46 +34.80% (sector-adaptive parameters)
- Lowest Drawdown Ever: CAT Alt47 3.96% max DD (across all 293 backtests!)
- Highest Win Rate: UNH Alt28 72.22% (legendary quality)
- Best Profit Factor: UNH Alt28 4.809 (exceptional risk/reward)
See DISCOVERIES_AND_LEARNINGS.md β Best by asset class and adjacent sections for the full leaderboards.
After systematic visual verification of all 388 screenshots:
- 1 exit bug found (SPY Alt39 - purple arrows stopped after 2017)
- 387 results validated as healthy with proper exit activity
- Methodology: Visual inspection of exit markers throughout 2010-2025
- See data-verification-plan.md for complete validation protocol
Not all profitable strategies suit options trading. Strategies need regular exits (3-12 weeks) to match options expiration. Visual cue: If the equity curve is zoomed (showing only 2010-2012 instead of full timeline), the strategy holds too long for options. The go/no-go list is maintained in DISCOVERIES_AND_LEARNINGS.md β Options trader final recommendations.
- Exit optimization > Entry optimization - Where you get out matters more than where you get in
- Profit targets are essential - Multi-stage profit taking (3N, 6N, 9N) outperforms trailing-only
- Pyramiding is mandatory - Single-position strategies catastrophically underperform
- Asset selection trumps strategy selection - Alt10 on Healthcare beats best strategy on Utilities
- Simplicity beats complexity - Top performers use 2-3 enhancements, not kitchen-sink approaches
Use Alt10, Alt45, or Alt26 on Healthcare/Technology stocks. Avoid Utilities and Energy entirely. Test thoroughly on YOUR instruments before live trading - what works on SPY may fail on your ticker.
293 Valid Backtests across 14 strategies and 21 securities (1 removed due to exit bug - see data-verification-plan.md)
Key Findings:
- Best Overall Strategy: Alt10 (Profit Targets) - 76.19% success rate (16/21 profitable)
- Best SPY Strategy: Alt26 (Fractional Pyramid) - +33.50% validated result
- Best ETF Strategy: Alt46 (Sector Adaptive) - XLV +34.80% return
- Lowest Drawdown Ever: Alt47 CAT - 3.96% max DD (across all 293 backtests)
- Sector Insight: Healthcare 92% success (12/13), Utilities 0% success (0/14)
- Data Quality: 388 screenshots validated, 387 healthy (99.74%), 1 exit bug found (SPY Alt39)
See DISCOVERIES_AND_LEARNINGS.md for complete analysis.
This project represents a systematic human-AI collaboration for discovering robust trend-following strategies. Here's the exact process used, which anyone can replicate:
Process: I used AI (primarily ChatGPT and Claude) to generate individual Pine Script strategies that embody Ed Seykota's trend-following principles while testing unique underlying theories.
Key Prompt Pattern:
"Create a TradingView Pine Script strategy that follows Ed Seykota's philosophy of cutting losses and letting winners run. The strategy should test [SPECIFIC THEORY] such as [fractional pyramiding / momentum-gated entries / profit targets / etc.]. Include proper position sizing, ATR-based stops, and Donchian channel entries."
Why This Worked:
- AI excels at generating syntactically correct Pine Script code
- Each strategy tested a distinct hypothesis (not just parameter tweaks)
- 40+ variations created, each exploring different exit logic, sizing methods, or filters
- AI provided consistent code structure while varying the experimental components
Process Overview: For each AI-generated strategy, I tested it across all 21 securities using an optimized workflow that dramatically reduced testing time.
I used Cursor (a VS Code fork) with Vim keybindings for lightning-fast code copying:
- Open Pine Script file in Cursor
- Click anywhere in the file
- Press
ggto jump to the top - Press
Shift+Vto enter Visual Line mode (selects entire line) - Press
G(uppercase) to extend selection to the bottom of the file - Press
Ctrl+Cto copy (standard Windows clipboard) - Alt+Tab to TradingView
- Paste into Pine Editor
Why This Matters: The entire code selection process takes <2 seconds. No mouse dragging, no scroll-and-shift-click, just muscle memory keystrokes.
When first loading a new Pine Script strategy in TradingView:
- TradingView prompts for backtest date range
- I selected dates with my mouse:
- Start Date: Beginning of 2010 (roughly January 2010)
- End Date: November 1, 2025 (current date at time of testing)
- This range was locked in for that strategy session
Critical Optimization: Once the strategy and date range were configured, TradingView remembered these settings. This meant I could systematically test all 21 securities without having to:
- Re-select the Pine Script strategy for each ticker
- Re-enter the date range for each ticker
- Manually configure any other strategy settings
After setting up one strategy with its date range, testing all 21 securities became extremely fast:
- Alt+Tab to TradingView (from documentation/screenshot workflow)
- Start typing the next ticker symbol (e.g., "M", "S", "F", "T")
- TradingView automatically opens the ticker search bar
- TradingView automatically recognizes whether I'm searching for:
- Individual stock (MSFT, GOOGL, AMZN, etc.)
- ETF (SPY, QQQ, XLV, XLE, etc.)
- Press Enter to load the ticker
- Strategy immediately runs on the new security with same date range
- Review results, capture screenshot (see below)
- Repeat for next ticker
Time Savings: This workflow reduced per-ticker testing from ~2-3 minutes (if reconfiguring each time) to ~15-30 seconds. Testing all 21 securities for one strategy went from 40-60 minutes to approximately 5-10 minutes.
Example Workflow for Alt47:
- Load Alt47 Pine Script, set 2010-2025 date range
- Type "FCX" + Enter β Test β Screenshot
- Type "GOOGL" + Enter β Test β Screenshot
- Type "AMZN" + Enter β Test β Screenshot
- ... (18 more securities)
- Complete all 21 tests in <10 minutes
For every backtest result:
- Strategy runs and displays results in TradingView
- Press Win + Shift + S (Windows Snipping Tool)
- Draw selection box around Strategy Tester panel
- Screenshot auto-saves to Windows Photos folder with timestamp
- Later: Navigate to Photos folder, move screenshots to sector folders
- Rename to descriptive format:
alt[X]-[result]_reduced.png
PowerShell Size Reduction: After capturing batches of screenshots, I ran resize_images.ps1 to reduce them by 35% (to 65% of original size). This was necessary because TradingView's high-resolution screenshots often exceeded Claude Code's image processing limits.
Every test used identical parameters:
- Initial Capital: $100,000
- Commission: 0.005% (0.5 basis points)
- Slippage: 2 ticks
- Backtest Period: ~2010-2025 (approximately 15 years of data)
Despite the manual workflow, this approach provided advantages automated testing couldn't:
- Visual equity curve analysis: Smooth vs choppy growth patterns immediately visible
- Zoom level indicators: TradingView auto-zooms when exits are rare (critical warning sign for options traders)
- Trade distribution patterns: Clustering of trades reveals market regime sensitivity
- Drawdown visualization: Shape and frequency of drawdowns matter, not just max DD number
- Quick pattern recognition: Human brain excels at spotting visual anomalies across hundreds of charts
Result: 294 backtests completed across 14 strategies and 21 securities with high-quality visual documentation of every result.
Process: I used Claude Code (AI coding assistant) to build the entire project skeleton:
Folder Structure Created:
sectors/
βββ technology-MSFT/
β βββ screenshots/
β βββ strategies/
βββ healthcare-UNH/
β βββ screenshots/
β βββ strategies/
βββ energy-XOM/
βββ utilities-DUK/
βββ etfs-SPY/
βββ etfs-QQQ/
βββ etfs-XLV/
... (11 sectors total, 21 securities)
What Claude Code Automated:
- Created 21 sector folders (11 individual stocks + 10 sector ETFs)
- Generated standardized subfolder structure (screenshots/, strategies/)
- Built utility scripts (resize_images.ps1 for managing screenshot sizes)
- Created documentation templates (DISCOVERIES_AND_LEARNINGS.md, analysis.csv)
- Set up naming conventions and file organization systems
Why This Mattered:
- Systematic organization prevents chaos when testing 210+ strategy-security combinations (10 strategies Γ 21 securities)
- Automated folder creation ensured consistency across all sectors
- Templates enforced disciplined documentation from day one
Process: For every strategy backtest, I captured evidence using Windows' built-in screenshot tool:
Steps:
- Run backtest in TradingView
- Press Win + Shift + S (Windows Snipping Tool)
- Draw selection box around TradingView's Strategy Tester panel
- Screenshot automatically saved to Windows Photos folder with timestamp
- Navigate to Photos folder, locate the screenshot
- Move screenshot from Photos to appropriate sectors/[ticker]/screenshots/ folder
- Rename file to descriptive format:
alt[X]-[result]_reduced.png- Example:
alt26-very-profitable_reduced.png
- Example:
Filename Conventions:
alt[X]= Strategy number being tested[result]= Performance category (very-profitable, profitable, scratch, unprofitable, catastrophic)_reduced= Indicates image has been resized (see next section)
Why Screenshots:
- Visual proof of every backtest result
- Equity curve reveals characteristics automated metrics miss
- Screenshots show TradingView's complete performance panel (trades, win rate, PF, drawdown, equity curve)
- Creates audit trail - anyone can verify results
The Problem: TradingView's high-resolution screenshots often exceeded 3000 pixels wide, which Claude Code couldn't process for analysis.
The Solution: Created resize_images.ps1 PowerShell script:
What It Does:
# Reduces all images by 35% (to 65% of original size)
# Recursively finds PNG/JPG files in all sector folders
# Skips files already containing "_reduced" in filename
# Uses high-quality bicubic interpolation
# Deletes original large files after successful resize
# Adds "_reduced" suffix to processed filesWhy 35% Reduction:
- Brings 4000px+ screenshots down to ~2600px (within Claude Code's limits)
- Preserves visual quality for analysis (bicubic interpolation)
- Reduces repository size significantly (hundreds of screenshots)
- Prevents recursive resizing (skips files with
_reducedsuffix)
Usage:
.\resize_images.ps1
# Processes all new screenshots in one batch
# Safe to run multiple times (won't re-process reduced images)The Problem: After capturing 388 backtest screenshots, a critical quality issue emerged: some strategies appeared profitable but were actually defective. The "exit bug" caused strategies to stop executing exits partway through the test period, accidentally becoming buy-and-hold instead of actively trading.
The Discovery: During analysis, one result looked suspicious - SPY Alt39 showed +121.89% returns but with visual anomalies:
- Purple exit arrows (marking position closures) stopped appearing after ~2017
- Equity curve began tracking the price line closely after 2017
- High returns with relatively few recent trades
This revealed a coding bug where the exit logic failed partway through the backtest, turning an active strategy into passive buy-and-hold. The inflated returns were misleading.
The Solution: Systematic Visual Validation
Created bug-log.txt and data-verification-plan.md to systematically audit all 388 screenshots:
What We Check For:
- Purple exit arrows - Should appear consistently from 2010 through 2024-2025
- β RED FLAG: Arrows stop partway through (especially after ~2017)
- Equity curve behavior - Should diverge from price line (shows strategy activity)
- β RED FLAG: Green line starts tracking red price closely after arrows stop
- Performance stats - Bottom left P&L vs right benchmark
- β RED FLAG: Numbers within ~10% of each other AND arrows have stopped
- Trade frequency - Should see consistent activity throughout timeframe
- β RED FLAG: High returns with no recent exit activity
Key Insight: Left P&L β Right benchmark alone is NOT a bug! Some strategies legitimately perform similar to buy-and-hold while still actively managing exits. Only the combination of similar numbers + stopped arrows indicates a defect.
Results:
- Total images analyzed: 143+ (ongoing)
- Bugs found: 1 (SPY Alt39 only - isolated incident)
- Status: All other verified images show healthy exit activity throughout 2010-2025
Why This Matters:
- Data integrity: Prevents counting false positives as strategy successes
- Transparency: Every result is visually validated, not just trusted
- Reproducibility: Anyone can audit the screenshots using the same criteria
- Research quality: Only legitimate results inform strategy development decisions
The Bug Pattern (INVALID results):
β Purple arrows STOP partway through chart
β Equity curve follows price closely after arrows stop
β Suspiciously high returns with no recent exits
β Strategy accidentally became buy-and-hold
Healthy Pattern (VALID results):
β
Purple arrows continue throughout 2010-2025
β
Equity curve diverges from price (shows strategy activity)
β
Trade markers present through recent periods
β
Strategy is actively managing positions
Documentation:
- bug-log.txt - Master list of confirmed bugs and verified images
- data-verification-plan.md - Complete validation protocol with visual examples
- Each sector folder contains only validated screenshots
Ongoing Process: New screenshots are validated before being included in analysis, ensuring research findings are based on legitimate strategy performance, not coding defects.
Process: As results came in from each validated strategy-security combination, I:
-
Recorded metrics in analysis.csv:
- Return %, Profit Factor, Win Rate %, Max Drawdown %
- Trade count, performance category, options suitability
-
Documented insights in DISCOVERIES_AND_LEARNINGS.md:
- What worked and why
- What failed and why
- Sector-specific patterns
- Strategy suitability by asset type
-
Used Claude Code for pattern recognition:
- Bulk analysis of screenshot results
- Aggregating performance across strategies
- Identifying strategy rankings and tier classifications
- Generating comparison tables and statistical summaries
Key Insight from This Process:
After testing 210+ strategy-security combinations, clear patterns emerged: Alt10 (Profit Targets) and Alt26 (Fractional Pyramid) both achieved 76% success rates, while utilities failed 100% of all strategies tested. These discoveries only emerged through systematic, comprehensive testing.
Reproducibility: Every step is documented and can be replicated by anyone with:
- TradingView account (free version works)
- AI access for Pine Script generation (ChatGPT, Claude, etc.)
- Windows computer for screenshot workflow
- PowerShell for image processing
Transparency: Nothing is hidden:
- All 40+ strategy codes are in pine-scripts/
- All screenshots are in sectors/ folders
- All analysis is in analysis.csv and DISCOVERIES_AND_LEARNINGS.md
- Failures documented alongside successes
- Bug detection: Defective results openly identified and invalidated (bug-log.txt)
Systematic Discovery: Not cherry-picking:
- Every strategy tested on same set of securities
- Standardized backtest settings eliminate variables
- Failed strategies kept for learning (not deleted)
- Honest documentation of what doesn't work
- Visual validation: Every screenshot checked for exit bugs before analysis
Human-AI Synergy: Leveraging strengths of both:
- AI: Generate code variations, build infrastructure, analyze patterns
- Human: Visual pattern recognition, hypothesis formation, judgment calls
- Together: Systematic testing at scale with qualitative insights
- Generate strategies: Ask AI to create Pine Scripts testing specific theories
- Setup infrastructure: Use Claude Code to create folder structure
- Test systematically: Run each strategy on each security, capture screenshots
- Manage images: Use resize_images.ps1 to handle screenshot sizes
- Validate screenshots: Check for exit bugs using data-verification-plan.md
- Document findings: Use templates provided to record insights
- Iterate: Learn from failures, refine theories, generate new strategies
The beauty of this approach: It's accessible to anyone. No expensive software, no advanced coding skills, no proprietary data. Just systematic application of free tools and disciplined documentation. Plus quality assurance: Visual validation ensures only legitimate results drive strategy decisions.
trend-following-backtesting-strategies/
βββ START_HERE.md β Begin here for sector testing guide
βββ README.md β You are here (project overview)
βββ pine-scripts/ β All 40+ TradingView strategy files
βββ sectors/ β Sector-by-sector testing results
β βββ technology/
β βββ healthcare/
β βββ energy/
β βββ ... (11 sectors total)
βββ resize_images.ps1 β Utility to manage screenshot sizes
βββ bug-log.txt β Bug detection log (quality assurance)
βββ data-verification-plan.md β Screenshot validation protocol
βββ Documentation files:
βββ DISCOVERIES_AND_LEARNINGS.md β Document your findings
βββ SECTOR_TESTING_WORKFLOW.md β Detailed testing methodology
βββ FINAL_10_STRATEGIES.md β Why these 10 for sector testing
βββ STREAMLINED_TESTING_GUIDE.md β Complete testing protocol
βββ ... (additional guides)
After testing 40 different strategy variations over 3 iterations, three strategies emerged as clear winners:
THE UNDISPUTED KING
- Profit Factor: 1.474
- Max Drawdown: 12.46%
- Win Rate: 51.82%
- Why it dominates: The perfect combination of intelligent position sizing (fractional pyramiding) and ironclad protection (breakeven locks). This strategy has the smoothest equity curve of all tested strategies.
PHENOMENAL PERFORMANCE
- Profit Factor: 1.466
- Max Drawdown: 12.45%
- Win Rate: 51.65%
- The trifecta: Combines fractional pyramiding, breakeven locks, AND momentum-gated entries. Three proven winners working in harmony.
BRONZE MEDAL
- Profit Factor: 1.396
- Max Drawdown: 12.45%
- Win Rate: 50.73%
- Smart additions: Fractional pyramiding enhanced with RSI-gated position adds for improved trade quality.
Backtest Period: January 2022 - October 2025 (SPY Daily) Initial Capital: $100,000 Strategies Tested: 40 variations across 3 iterations
- Iteration 1 (Alts 1-20): ~30% profitable
- Iteration 2 (Alts 21-30): 70% profitable
- Iteration 3 (Alts 31-40): 90% profitable! π―
| Iteration | Best Strategy | Return | Improvement |
|---|---|---|---|
| 1 | Alt 10 (Profit Targets) | +20.3% | Baseline |
| 2 | Alt 26 (Fractional Pyramid) | +33.5% | +65% |
| 3 | Alt 31 (Fract + BE Lock) | +40.1% | +97% total |
Nearly doubled performance over 3 iterations!
Fractional Pyramiding + Breakeven Lock = Maximum Performance
This combination proved superior to any other two-element pairing. It delivers:
- Best sizing strategy (100% β 75% β 50% β 25%)
- Best protection (move stop to breakeven after 2N profit)
- Lowest drawdown among top performers
- Smoothest equity curve ("almost always up")
- Profit Targets Are Essential - Multi-stage profit-taking (3N, 6N, 9N) dramatically outperforms all-or-nothing exits
- Pyramiding Is Mandatory - Single-position strategies catastrophically underperform (-21.8%)
- Slower Entries Filter Noise - 55-bar Donchian >> 20-bar breakouts (40% vs -93%)
- Exit Optimization > Entry Optimization - Where you get out matters more than where you get in
- Simplicity Beats Complexity - Two well-chosen elements outperform kitchen-sink approaches
- Fractional Sizing Wins - Descending position sizes (100%β75%β50%β25%) beat equal sizing
- Breakeven Locks Work - Moving stops to breakeven after 2N profit reduces risk without sacrificing returns
- Fast Breakouts - 20-bar entries = -93% (death by whipsaws)
- No Pyramiding - Single positions = -21.8% (missed compounding)
- Adaptive Entry Levels - Keltner channels = -58.5% (complexity doesn't help)
- Alternative Trailing Methods - Parabolic SAR = -16.8% (Chandelier superior)
- Excessive Filtering - ADX, dual timeframe, anti-chop filters all reduce performance
- Time-Based Exits - Markets don't care about your calendar = -21.7%
- Too Many Features - "ULTIMATE" strategy with all features only placed 4th
All strategy files are ranked by performance using this naming convention:
RANK_PF-X.XXX_strategy-name.pine
Example:
01_PF-1.474_seykota_alt31_fractional_breakeven.pine π KING
02_PF-1.466_seykota_alt38_triple_combo.pine π₯ RUNNER-UP
03_PF-1.396_seykota_alt34_fractional_momentum.pine π₯ BRONZE
...
24_PF-0.131_seykota_alt1_fast_breakout.pine π DISASTER
- RANK: Performance ranking (1 = best)
- PF-X.XXX: Profit Factor (>1.0 = profitable, >1.3 = excellent)
- strategy-name: Descriptive name of the approach
- PF > 1.40: Elite performers (top 2)
- PF 1.30-1.40: Excellent strategies (ranks 3-6)
- PF 1.20-1.30: Solid performers (ranks 7-14)
- PF 1.00-1.20: Profitable but mediocre (ranks 15-19)
- PF < 1.00: Net losers (ranks 20-24)
- Entry: 55-bar Donchian breakout (slow and steady)
- Position Sizing: 1% risk per unit, 4 units maximum
- Initial Stop: 2N (2Γ Average True Range)
- Profit Targets: Multi-stage at 3N, 6N, 9N
- Trailing Stop: Chandelier (ATR-based) for remainder
-
Fractional Pyramiding (Alts 31, 38, 34, 26, 35, 40, 36)
- Position sizes: 100% β 75% β 50% β 25%
- Adds every 0.5N in profit
-
Breakeven Lock (Alts 31, 38, 21, 36, 37, 40)
- Move stop to entry after 2N profit
- Guarantees no loss on mature positions
-
Momentum Gating (Alts 38, 34, 30, 36, 32, 40)
- Only add to positions when RSI confirms strength
- Improves pyramid quality
-
Time-Based Tightening (Alts 35, 37, 32, 25, 40)
- After 30 bars, tighten trail from 3N to 1.5N
- Protects aging positions
Understanding what doesn't work is as important as knowing what does:
-
Alt 1: Fast Breakout (-93.2%, PF 0.131)
- 20-bar entries = constant whipsaws
- 280 trades with 18.6% win rate
- Lesson: Speed kills
-
Alt 23: Keltner Channel (-58.5%, PF 0.744)
- Adaptive EMAΒ±ATR entry levels completely failed
- Complexity doesn't improve signal quality
- Lesson: Stick to simple Donchian breakouts
-
Alt 15: Single Position (-21.8%, PF 0.177)
- Only 12 trades in 3+ years
- 8.3% win rate (catastrophic)
- Lesson: Pyramiding is essential
-
Turtle Core v2.1 (-20.9%, PF 0.715)
- 10-bar exit too tight, gave back all gains
- Good entries, terrible exits
- Lesson: Exits matter more than entries
Start here if you want to:
-
Use These Strategies for Trading β Read START_HERE.md then test on YOUR instruments
- Don't assume Alt 31 works on everything (it doesn't!)
- Test the 10 representative strategies on your target tickers
- Follow the 4-phase protocol to find what works for YOU
-
Learn From the Research β Read the complete strategy analysis:
- This README for overview and top performers
- DISCOVERIES_AND_LEARNINGS.md for detailed findings
- Individual .pine files to see implementation details
-
Replicate the Study β All strategies and methodology are documented:
- 40+ TradingView Pine Script files in pine-scripts/
- Testing methodology in SECTOR_TESTING_WORKFLOW.md
- Screenshot evidence in sectors/ folder
-
Contribute Your Findings β Test additional sectors/instruments:
- Follow the testing protocol
- Document your results
- Share discoveries with the community
Recommended strategies for SPY (in order):
- Alt 31 - Best overall performance, smoothest equity curve (PF: 1.474)
- Alt 38 - Highest profit factor, slightly more aggressive (PF: 1.466)
- Alt 34 - Excellent risk-adjusted returns (PF: 1.396)
All three strategies have:
- Similar low drawdowns (~12.5%)
- Win rates >50%
- Profit factors >1.39
- Proven performance across bull/bear markets (2022-2025)
Promising areas to explore:
- Complete sector testing across all market segments
- Identify sector-specific strategy patterns
- Parameter optimization for top strategies per sector
- Walk-forward analysis for robustness testing
- Different timeframes (4-hour, weekly)
- Portfolio approach with sector-appropriate strategies
Avoid these dead ends (learned the hard way):
- Fast breakout periods (<40 bars)
- Single-position approaches
- Complex adaptive entry systems
- Alternative trailing stop methods (Parabolic SAR, etc.)
- Excessive filtering (ADX, regime, anti-chop)
| Rank | Strategy | Return | PF | Win Rate | Drawdown |
|---|---|---|---|---|---|
| 1 | Alt 31: Fract + BE Lock | +40.1% | 1.474 | 51.8% | 12.46% |
| 2 | Alt 38: Triple Combo | +38.9% | 1.466 | 51.7% | 12.45% |
| 3 | Alt 34: Fract + Momentum | +33.8% | 1.396 | 50.7% | 12.45% |
| 4 | Alt 26: Fractional Pyramid | +33.5% | 1.388 | 50.7% | 15.49% |
| 5 | Alt 40: ULTIMATE | +31.3% | 1.348 | 51.9% | 12.47% |
| 6 | Alt 36: BE + Momentum | +28.4% | 1.338 | 50.0% | 15.75% |
| 7 | Alt 21: Breakeven Lock | +28.2% | 1.335 | 49.8% | 15.59% |
| 8 | Alt 35: Fract + Time | +28.1% | 1.306 | 50.5% | 12.49% |
| 9 | Alt 37: BE + Time | +26.4% | 1.301 | 50.2% | 15.67% |
| 10 | Alt 30: Momentum Pyramid | +23.6% | 1.277 | 48.1% | 16.04% |
All profitable strategies above breakeven, ranging from +5.6% to +24.4%. See LESSONS_LEARNED.md for complete details.
Net negative strategies kept for educational purposes. Study these to understand what NOT to do.
After extensive testing on SPY, a critical insight emerged: strategy performance is highly dependent on the underlying asset's characteristics. What works brilliantly on SPY may fail on individual stocks or sector ETFs.
A systematic sector testing framework to discover which strategies work for which market segments:
-
10 Representative Strategies Selected - Chosen to test different hypotheses (not just performance tiers):
- Baseline (Classic Turtle)
- Alt 2 (EMA Crossover - different entry)
- Alt 9 (Time Exit - different exit philosophy)
- Alt 10 (Profit Targets - early profit taking)
- Alt 15 (Single Position - no pyramiding)
- Alt 17 (Dual Timeframe - confluence)
- Alt 20 (Asymmetric - long/short bias)
- Alt 22 (Parabolic SAR - adaptive exits)
- Alt 26 (Fractional Pyramid - smart sizing)
- Alt 28 (ADX Filter - trend strength)
-
11 Market Sectors Covered:
- ETFs (QQQ, XLE, XLU)
- Technology, Healthcare, Energy
- Financials, Industrials, Utilities
- Consumer Cyclical/Defensive
- Communication Services, Real Estate, Basic Materials
-
4-Phase Testing Protocol (~15 min per ticker):
- Phase 1: Foundation (Baseline, Alt 15, Alt 26)
- Phase 2: Entry Filters (Alt 2, Alt 28, Alt 17)
- Phase 3: Exit Optimizations (Alt 10, Alt 22, Alt 9)
- Phase 4: Special Cases (Alt 20)
- Identify universal strategies (work across many tickers)
- Identify sector-specific strategies (niche edges)
- Discover trend-friendly vs difficult sectors
- Build strategy-sector matching decision tree
To manage screenshot file sizes efficiently, a PowerShell utility is included:
resize_images.ps1 - Automatically resize screenshots by 35%
- Recursively finds all PNG/JPG images
- Reduces to 65% of original dimensions
- Adds
_reducedsuffix to processed files - Skips already-reduced images (prevents recursive resizing)
- Deletes original large files
- High-quality bicubic interpolation
Usage:
.\resize_images.ps1This helps keep the repository size manageable when storing hundreds of backtest screenshots across multiple sectors.
- START_HERE.md - Quick start guide for sector testing (read this first!)
- STREAMLINED_TESTING_GUIDE.md - Complete testing methodology
- QUICK_REFERENCE_10_STRATEGIES.md - Print-friendly strategy reference card
- FINAL_10_STRATEGIES.md - Why these 10 strategies were selected for sector testing
- DISCOVERIES_AND_LEARNINGS.md - Document findings as you test
- SECTOR_TESTING_WORKFLOW.md - Detailed sector testing workflow
- SECTOR_TICKERS.md - Recommended tickers for each sector (2-3 per sector)
- QUICK_TEST_CHECKLIST.md - Testing checklist
- Individual .pine files - TradingView Pine Script implementations (40+ strategies)
- sectors/etfs/ - Original SPY backtest results and screenshots
This project embodies several key principles:
"The elements of good trading are: (1) cutting losses, (2) cutting losses, and (3) cutting losses."
Our implementation: Initial stops, profit targets, trailing stops, and breakeven locks.
"Win or lose, everybody gets what they want out of the market."
Systems focused on profit-taking win. Systems that fear missing out (no profit targets) lose. The market gives you what your system asks for.
"The goal of successful strategy development is to build the best system. Money is secondary. Complexity is secondary."
Simplicity + Profit Targets + Pyramiding = Winner
The backtest period (2022-2025) includes diverse market conditions:
- 2022: Severe bear market (-18% SPY)
- 2023-2024: Recovery and new all-time highs
- 2024-2025: Continued volatility and uncertainty
Top strategies proved robust across all these environments, demonstrating true trend-following resilience.
When reviewing backtest screenshots, the equity curve's X-axis time range is extremely revealing:
Full Timeline (1993-2025):
- Strategy has regular exits throughout the backtest period
- Equity curve shows complete P&L history
- Total P&L (left) matches equity curve endpoint (right)
- β Suitable for options traders who need frequent exits
Zoomed Timeline (e.g., 2010-2012 only):
- Strategy has very few exits - TradingView auto-zooms to where trades occurred
- Equity curve only shows small portion of backtest
- Total P&L (left) includes unrealized gains from long-held positions
- Equity curve endpoint (right) shows value at zoom endpoint, NOT final value
- β NOT suitable for options traders - positions held too long
Example: Alt 6 Pure ATR Stop shows +$282K Total P&L but -$15K equity at chart end. The equity curve is zoomed to 2010-2012 (early losing period) because the strategy holds positions without exiting from 2013-2025. Those unrealized gains inflate the Total P&L but aren't visible on the zoomed chart.
For Options Traders: Immediately discard any strategy screenshot with a zoomed equity curve. You need strategies that close positions regularly, which will show full timeline equity curves.
This is educational research, not investment advice.
- Past performance does not guarantee future results
- All backtests are subject to curve-fitting risk
- Walk-forward testing recommended before live trading
- Use appropriate position sizing for your risk tolerance
- Consider paper trading before risking real capital
Current Phase: Multi-Sector Testing & Analysis
Completed:
- β 40 strategy variations tested on SPY
- β 3 complete iterations
- β Comprehensive documentation
- β Clear performance rankings
- β Golden Combo identified (Alt 31)
- β Sector testing framework developed
- β Image management utilities created
Recent Discovery: Alt 31 works great on SPY but may fail on other tickers. This critical finding led to the development of a systematic sector testing workflow to discover which strategies work for which market segments.
Current Focus:
- Testing 10 representative strategies across all market sectors
- Identifying sector-specific strategy performance patterns
- Building strategy-sector matching system
- Documenting findings for the trading community
Next Steps:
- Complete sector testing (Technology, Healthcare, Energy, Utilities, etc.)
- Develop sector-optimized strategy variants
- Create strategy selector based on ticker characteristics
- Begin paper trading with sector-appropriate strategies
- Walk-forward analysis for robustness validation
This is an open research project documenting a systematic approach to trend-following strategy development. The methodology and results are shared for educational purposes.
1. Direct Application:
- Clone/download the repository
- Test strategies on your instruments using TradingView
- Use the SECTOR_TESTING_WORKFLOW.md as your guide
- Document your findings in the appropriate sector folders
2. Learn From the Process:
- Study the iteration-by-iteration improvement (from -93% to +40%)
- Understand what works and what fails (and why)
- Apply the systematic testing methodology to your own strategy ideas
- Avoid the documented "dead ends"
3. Contribute Your Findings: If you test these strategies on additional instruments/sectors:
- Document your results using the provided templates
- Share screenshots and performance metrics
- Add insights to DISCOVERIES_AND_LEARNINGS.md
- Help build the community knowledge base
4. Build Upon This Work:
- Optimize parameters for specific sectors
- Test on different timeframes
- Develop sector-specific variants
- Create automated strategy selectors
- Share improvements back to the community
Transparency: Every strategy is documented with:
- Complete Pine Script source code
- Backtest screenshots
- Performance metrics
- Analysis of why it works (or fails)
Systematic Approach: Not cherry-picked results:
- All 40 strategies tested on same timeframe
- Failures documented alongside successes
- Clear methodology anyone can replicate
- Honest evaluation of what doesn't work
Actionable Insights: Beyond just "here's a profitable strategy":
- Understanding of WHY strategies work
- Knowledge of WHEN they fail
- Framework for testing YOUR instruments
- Methodology for continuous improvement
Through systematic testing and learning from failures, strategy performance improved by 97% over 3 iterations (-93% β +40%), proving that:
- Disciplined experimentation beats guru predictions
- Systematic testing reveals hidden patterns
- Understanding failures is as valuable as celebrating successes
- Strategy performance is asset-dependent (Alt 31 on SPY β Alt 31 on everything)
The journey from failure to success is the real value, not just the final strategy.
"The goal of a successful trader is to make the best trades. Money is secondary." - Alexander Elder
Last Updated: November 2, 2025 Strategies Tested: 40 (SPY); 10 selected for multi-sector testing SPY Success Rate: 90% (Iteration 3) Best SPY Strategy: Alt 31 (+40.1%, PF 1.474) Current Phase: Multi-sector testing to identify strategy-asset matching patterns