Trading robot · MT5

P4 Pattern Strategy

by junthy-me

This MetaTrader 5 expert advisor identifies and trades a proprietary geometric P4 swing pattern.

GitHub stars1
Forks0
Last update5 months ago31 Mar 2026
LicenceNone stated

Overview

P4 Pattern Strategy scans for a multi-point price skeleton using historical data and triggers entries at P4 when specific price ratios and time constraints are met. The system requires an account in hedging mode to manage trade-specific snapshots and P5/P6 evolution. Risk management features include fixed lot sizing, money-based stop losses, and take profit targets. It also employs mandatory observation periods after trade exits to prevent rapid overtrading on the same symbol.

Details

Author

junthy-me on GitHub

Type

Trading robot

Platform

MetaTrader 5 (MQL5)

Strategy

SMC / ICT / price action, Hedging

Markets

Gold, Forex

Timeframes

M15-H1

Risk profile

  • Holds opposite positions at once

Input parameters

Read from P4PatternStrategy.mq5. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
InpSymbolsstringXAUUSDm
InpTFENUM_TIMEFRAMESPERIOD_M30
InpTimerMillSecint100
InpMagiclong9527001
InpCommentstringP4PatternStrategy
InpFixedLotsdouble0.05
InpMaxPositionsPerSymbolint1
InpSlippagePointsint20
InpProfitObservationBarsint10
InpStopObservationBarsint10
InpMaxProfitStopMoneydouble0.0
InpMaxLossStopMoneydouble0.0
Show all 33 inputs
NameTypeDefaultDescription
InpLookbackBarsint150
InpAdjustPointMinSpanKNumberint0
InpAdjustPointMaxSpanKNumberint20
InpCondAXMindouble0.75
InpCondAXMaxdouble1.25
InpP3P4MoveMinRatioOfStructuredouble0.75
InpCondCZdouble1.0
InpP1P2AValueSpaceMinPriceLimitdouble5.0
InpP1P2AValueTimeMinKNumberLimitint5
InpBSumValueMinRatioOfAValuedouble2.0
InpBSumValueMaxRatioOfAValuedouble5.0
InpTradeDirectionModeENUM_TRADE_DIRECTION_MODELONG_ONLY
InpPreCondEnablebooltrue
InpPreCondPriorMoveLookbackBarsint30
InpPreCondPriorMoveMinRatioOfStructuredouble1.1
InpPreCondPriorMoveMinBarsBetweenPre0AndP0int0
InpRequiredSwingExtremaSegments_Pre0P0_P0P1_P1P2_P2P3_P3P4stringtrue,true,false,false,false
InpP5P6ReboundMinRatioOfP3P5Dropdouble0.55
InpSoftLossCdouble1.0
InpP5AnchoredProfitCdouble2.0
InpEnableExactSearchCompareboolfalse

How to install it

  1. 1Download the sourceUse "Download source (.zip)" above, or clone junthy-me/MT5TradeAlgo from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
  3. 3Copy the filesCopy the .mq5 file into Experts.
  4. 4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
  5. 5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.

Similar expert advisors

Tip Top AI

by sournk
1 stars

Tip Top AI is a price action robot for MetaTrader 4 and MetaTrader 5 that uses a proprietary candle tail length algorithm to identify market entries. The strategy calculates the average size of historical bars and monitors current candles for specific wick-to-body ratios. It enters trades when wicks exceed the body siz

MT4MT5 Trading robot SMC / ICT / price actionGridHedging High risk
Updated 2 years ago None stated GitHub repository of Tip Top AI

GoldEngine Sentinel

by vivekpanchal2489
1 stars

GoldEngine Sentinel is a specialized expert advisor for MetaTrader 5, designed specifically for trading spot gold. It utilizes an advanced architecture combining dual-AI ONNX models: SuperGRU for macro bias and Master AI for micro order flow analysis. Trade execution is filtered through Gaussian Kernel Channels and Nad

MT5 Trading robot AI / machine learningMean reversionSMC / ICT / price action
Updated 5 days ago None stated GitHub repository of GoldEngine Sentinel

Susu Engulf

by Chongcharen
1 stars

Susu Engulf is a MetaTrader 4 expert advisor that automates trading based on engulfing candlestick patterns and technical indicators. It utilizes a combination of MACD and five distinct moving averages to determine trend direction and entry points. The EA manages risk through a maximum order limit and a money managemen

MT4 Trading robot Trend followingSMC / ICT / price actionGrid High risk
Updated 8 years ago None stated GitHub repository of Susu Engulf

EA Scalper XAUUSD

by francomascareloai
236 stars

EA Scalper XAUUSD is an automated trading research project for MetaTrader 5 focused on gold. It employs a multifaceted entry strategy using Smart Money Concepts like order blocks and liquidity sweeps, alongside moving average crossovers and Fibonacci zones. The EA includes a self-learning module designed to adapt to di

MT5 Trading robot SMC / ICT / price actionIndicator crossoverScalping High risk
Updated 3 months ago Custom licence GitHub repository of EA Scalper XAUUSD

Nyao Scalper

by elrizwiraswara
173 stars

Nyao Scalper is an automated scalping robot for MetaTrader 5 that utilizes a multi-factor weighted scoring system to identify trade opportunities. It evaluates trend alignment through EMA crossovers, momentum via RSI, and price action through wick rejection and candle body analysis. The EA manages risk with adaptive AT

MT5 Trading robot ScalpingTrend followingMartingale High risk
Updated 3 months ago BSD-3-Clause GitHub repository of Nyao Scalper

Gold Trader EA

by mehdi-jahani
141 stars

Gold Trader EA is a multi-strategy expert advisor designed for trading XAUUSD on the MetaTrader 5 platform. It employs a fusion engine that combines up to 14 different technical analysis methods, including candlestick patterns, chart patterns, price action, and institutional levels. The system requires a user-defined n

MT5 Trading robot Multi-strategyTrend followingIndicator crossover
Updated 1 year ago None stated GitHub repository of Gold Trader EA

More trading robots

Need a broker for MT5?

Compare regulated brokers that support MetaTrader, with spreads, minimum deposits and leverage side by side.

Compare brokers