PatternExplorer for Amibroker — Top Strategies, Filters, and Scans

PatternExplorer for Amibroker: A Complete Guide to Finding High-Probability Setups

What PatternExplorer is

PatternExplorer is a pattern-scanning and analysis approach implemented within AmiBroker that automates discovery and testing of recurring price-action setups. It systematically scans historical price data for defined structural patterns (e.g., breakouts, retests, reversal bars, continuation flags), ranks matches by statistical outcomes, and helps turn visual patterns into testable trading rules.

Why use it

  • Efficiency: scans thousands of symbols and timeframes quickly.
  • Objectivity: converts subjective pattern recognition into reproducible rules.
  • Statistical validation: shows hit rates, expectancy, drawdowns, and sample-size metrics so you can focus on patterns with robust edge.
  • Customization: you can define pattern templates, filters (volume, volatility, trend), and rule-based entry/exit variations.

Core components in AmiBroker

  1. Pattern definitions: codified with AFL formulas describing bar sequences, wick/body ratios, volume conditions, and relative price positions.
  2. Scanner engine: runs the pattern queries across symbol universes and timeframes, outputting occurrences and metrics.
  3. Backtester integration: maps pattern occurrences to entry/exit rules for walk-forward or in-sample/out-of-sample testing.
  4. Ranking & filters: statistical filters (minimum N, win rate, expectancy), contextual filters (higher timeframe trend, support/resistance zones), and portfolio-level constraints.
  5. Reporting dashboards: tables and charts for frequency, performance distribution, and equity curves for selected patterns.

How to build high-probability setups (practical steps)

  1. Choose universe & timeframe: pick liquid symbols and an intraday/daily timeframe that fits your edge.
  2. Define precise pattern rules: codify exact bar relationships (e.g., engulfing: current close > prior high; current body > prior body × 1.2).
  3. Add context filters: require higher-timeframe trend alignment, minimum volume percentile, ATR-based volatility band, or distance from major support/resistance.
  4. Scan historic data: run PatternExplorer across at least several hundred pattern occurrences (preferably 500+).
  5. Analyze stats: focus on expectancy, max adverse excursion, win rate, and sample size. Reject patterns with low N or unstable expectancy.
  6. Optimize conservatively: tweak filters to improve robustness (not curve-fit); prefer filters that generalize across symbols/timeframes.
  7. Backtest rules: convert pattern matches into entry/exit rules and run portfolio-level backtests with realistic slippage and commission.
  8. Walk-forward and paper trade: validate out-of-sample and forward test in paper or small live sizing before scale.

Common pattern templates to test

  • Breakout from consolidation (range, flag, wedge) with volume surge.
  • Pullback to moving average or trendline in an uptrend (mean-reversion entries).
  • Momentum continuation candle after VWAP/EMA confluence.
  • Reversal patterns at structural support/resistance (pin bar, engulfing) with confirmation.
  • False-break with quick reversal (stop-hunt) setups.

Risk management & sizing

  • Fixed-percent risk per trade (e.g., 0.5–1% of equity) using ATR-based stops.
  • Position sizing scaled by volatility (ATR) and capital risk limit.
  • Portfolio constraints: maximum concurrent positions and sector exposure limits.
  • Stop placement: technical stops (below structure) plus trailing rules for winners.

Tips to avoid overfitting

  • Use large and diverse symbol sets.
  • Favor simple, explainable rules over many micro-conditions.
  • Keep a holdout (out-of-sample) period for validation.
  • Penalize complexity: require improvements to generalize across markets/timeframes.

Quick AFL starter snippet (pattern detection scaffold)

afl

// Example: simple bullish engulfing detection BullEngulf = Close > Ref(Open,-1) AND Open < Ref(Close,-1) AND (Close - Open) > 1.2(Ref(Close,-1) - Ref(Open,-1)); Buy = BullEngulf; Sell = Cross(Ref(Close,-1), Close); // placeholder exit

Decision checklist before trading a discovered pattern

  • Sample size ≥ 200 occurrences?
  • Positive expectancy and acceptable max drawdown?
  • Logical economic rationale for why pattern should persist?
  • Robust across symbols/timeframes and in out-of-sample tests?
  • Practical execution: fills, slippage, liquidity acceptable?

Next steps

  • Convert your highest-ranked pattern into full AFL entry/exit rules.
  • Run portfolio backtest with realistic costs and walk-forward validation.
  • Start small in forward testing and scale only after consistent results.

Comments

Leave a Reply