Price Action Day Trader
A daily price action EA that identifies pin bar, engulfing, and inside bar candlestick patterns to generate trade signals, filtered by EMA trend direction and support/resistance proximity. It employs risk-based position sizing, daily loss limits, breakeven and trailing stop management, with automated broker filling mode detection for robust order execution.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The core strategy of this EA trades classic price action candlestick patterns, including pin bars (long-wick reversal patterns), bullish/bearish engulfing patterns, and inside bar breakouts. Entry conditions require candlestick pattern signals to align with the EMA trend direction (determined by the crossover relationship between the 20-period fast and 50-period slow EMAs), and pin bars must additionally form near support/resistance levels. Exit conditions include fixed stop loss and take profit based on a configurable risk:reward ratio, breakeven stop loss movement, and a trailing stop mechanism. Position sizing dynamically calculates lot size based on a risk percentage of account balance, ensuring each trade's risk is controlled and proportional. Money management incorporates a daily maximum loss percentage limit that halts new trading when the daily loss threshold is breached, along with an optional end-of-day position closure feature.
Strengths
- Comprehensive risk management system including risk-based dynamic position sizing, daily maximum loss limit, and configurable risk:reward ratio
- Multiple candlestick pattern recognition with EMA trend filtering and support/resistance confirmation provides relatively strict entry conditions
- Robust order execution with auto-detection of broker filling modes, alternative filling mode retry on failure, stop level validation, and freeze level checks
Weaknesses
- Only one position at a time is allowed (new entries require PositionsTotal()==0), severely limiting the strategy's profit potential and flexibility
- Support/resistance identification is overly simplistic, using only a fixed tolerance to match historical highs/lows without proper key level clustering logic
- No spread filter or slippage protection, which can cause candlestick pattern distortion and excessive trading costs in high-spread environments
- Inside bar breakout signal uses the current unclosed bar (index=0) for breakout confirmation, leading to unstable signals and potential repeated triggers
Possible improvements
- Add a spread filter mechanism to skip trading when the spread exceeds a threshold, avoiding irrational entries in high-spread environments
- Improve support/resistance identification by introducing price clustering or fractal-based detection with strength scoring for better filtering quality
- Allow multiple simultaneous positions or add a maximum position count parameter to improve profitability when multiple signals occur concurrently
Risk assessment
Overall risk: Low
- Inside bar breakout signal uses the unclosed current bar for confirmation, which may generate false signals before bar closure leading to unnecessary entries
- No spread filter present, potentially encountering significant slippage and wide spreads during low-liquidity sessions (e.g., at the 2 AM trading start hour)
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
RiskPercent | 1.5 | Risk per trade as balance percentage |
StopLossPips | 40 | Stop loss in points |
TakeProfitRatio | 2.0 | Risk-reward ratio (TP/SL) |
MaxDailyLoss | 3.0 | Max daily loss as balance percentage |
PinBarPipSize | 10 | Pin Bar minimum wick size in points |
PinBarRatio | 2.0 | Pin Bar wick-to-body ratio |
EngulfingMinPips | 15 | Engulfing pattern minimum candle size in points |
SRLookback | 20 | Support/resistance lookback period count |
SRTolerance | 10 | Support/resistance tolerance in points |
FastMA | 20 | Fast MA period |
SlowMA | 50 | Slow MA period |
MAMethod | MODE_EMA | MA calculation method |
StartHour | 2 | Trading start hour (broker time) |
EndHour | 20 | Trading end hour (broker time) |
CloseAtEndOfDay | true | Close positions at end of trading day |
MagicNumber | 123456 | EA magic number |
UseBreakEven | true | Enable move SL to break-even |
BreakEvenPips | 20 | Points to trigger break-even |
UseTrailingStop | true | Enable trailing stop |
TrailingStopPips | 30 | Trailing stop distance in points |
TrailingStepPips | 10 | Trailing stop step in points |
FillingMode | ORDER_FILLING_FOK | Preferred filling mode |
AutoDetectFilling | true | Auto-detect broker filling mode |
Similar Candlestick Pattern EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.