Trading robot · MT5

Bollinger Bands and Trend EA

by kristsada-cw

This MetaTrader 5 expert advisor combines Bollinger Band mean-reversion, squeeze breakouts, and EMA crossover trend following.

GitHub stars2
Forks1
Last update1 year ago14 Sep 2025
LicenceNone stated

Overview

Bollinger Bands and Trend EA filters for ranging markets using a long-period EMA slope to execute reversal trades with candlestick confirmation, specifically identifying Doji patterns at the bands. Risk management includes dynamic ATR-based stop losses, fixed take profit targets, and automated breakeven logic. The EA calculates position sizes based on a set risk percentage per trade and includes a trailing stop for its trend-following mode. Volatility filters ensure trades only open during sufficient market movement. The repository lacks a README.

Details

Author

kristsada-cw on GitHub

Type

Trading robot

Platform

MetaTrader 5 (MQL5)

Strategy

Mean reversion, Breakout, Indicator crossover, Trend following

Markets

Oil & commodities, Forex

Timeframes

M15-H1, H4 and above

Risk Profile

No grid, martingale or hedging logic was found in its code or README. That says nothing about how it performs: backtest it first.

Input Parameters

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

NameTypeDefaultDescription
EA_NamestringBollinger_Bands_EAEA Name for comments/logs
RiskPerTradePercentdouble1.0Risk percentage per trade (e.g., 1.0 for 1%)
StopLossATRMultiplierdouble2.5Adjusted: Stop Loss as a multiplier of ATR (e.g., 2.5 * ATR)
TakeProfitPipsint750Take Profit in pips (from entry price) - Original 1:3 RRR with 250 SL
BBPeriodint20Bollinger Bands Period
BBDeviationdouble2.0Bollinger Bands Standard Deviations
BBMethodENUM_MA_METHODMODE_SMABollinger Bands Moving Average Method (kept for clarity in inputs)
BBAppliedPriceENUM_APPLIED_PRICEPRICE_CLOSEBollinger Bands Applied Price
SqueezeLookbackBarsint100Bars to look back for the lowest Bollinger Band Width
ATRPeriodint14Period for ATR calculation for dynamic SL and candle body check
MinConfirmationBodyATRMultiplierdouble0.3Minimum confirmation candle body size as a multiplier of ATR
MaxDojiBodyRatiodouble0.1Max body size relative to range for a Doji (e.g., 0.1 for 10%)
Show all 26 inputs
NameTypeDefaultDescription
LongEMAPeriodForRangingint200Period for EMA to check ranging market
MaxEMASlopeForRangingdouble0.00001Max slope for EMA to consider market ranging (adjust based on symbol's point size)
MinATRForTradingMultiplierdouble0.5Minimum current ATR (as multiplier of ATR) required for any trade
MaxSqueezeWidthATRMultiplierdouble1.0Max BB Width (as ATR multiplier) for a squeeze to be considered valid
BreakevenTriggerPipsint100Profit in pips to move SL to breakeven
BreakevenBufferPipsint50Pips to add to breakeven SL (to cover spread/commission)
MaxLotSizedouble1.0Maximum lot size to trade
EnableTradingbooltrueEnable/Disable trading by this EA
MagicNumberlong223344Unique ID for Bollinger Bands strategy trades
EnableTrendFollowingbooltrueEnable/Disable Trend Following Strategy
TrendFastEMAPeriodint10Fast EMA period for Trend Following
TrendSlowEMAPeriodint20Slow EMA period for Trend Following
TrendTrailingStopPipsint50Trailing Stop in pips for Trend Following trades (0 to disable)
TrendMagicNumberlong334455Unique ID for Trend Following strategy trades

How to Install It

  1. 1Download the sourceUse "Download source (.zip)" above, or clone kristsada-cw/Automate-trading 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

2 stars

This MetaTrader 5 expert advisor focuses on the EURUSD pair using an adaptive market regime approach. It alternates between trend-following and mean-reversion logic based on ADX and EMA indicators. The trend strategy utilizes price breakouts or pullbacks confirmed by RSI, while the range strategy employs Bollinger Band

MT5 Trading robot Trend followingBreakoutMean reversion

Swing Trading EA

by JonusNattapong
1 stars

This expert advisor for MetaTrader 5 implements a medium-term swing trading strategy using multiple technical indicators. It identifies entries through two primary methods: trend reversals and breakouts from consolidation zones. The reversal logic utilizes Fibonacci retracement levels combined with Stochastic and MACD

MT5 Trading robot Trend followingBreakoutMean reversion
Updated 1 year ago None stated GitHub repository of Swing Trading EA

Trend Matrix EA

by Rhett-Q
1 stars

Trend Matrix EA is a multi-model trend-following robot for MetaTrader 5, specifically optimized for Gold trading. It utilizes a scoring matrix based on several technical indicators including Moving Averages, MACD, ADX, and Bollinger Bands to determine entries. The system employs a conservative pyramiding approach, addi

MT5 Trading robot Trend followingBreakoutIndicator crossover
Updated 5 weeks ago None stated GitHub repository of Trend Matrix EA

Axuusd Gold Advisor

by damozycodes
1 stars

This expert advisor is designed specifically for trading gold on the MetaTrader 4 platform. It employs a hybrid strategy approach, allowing users to toggle between trend following using moving average crossovers, mean reversion via RSI and Stochastic divergence, and breakout patterns. Trade management includes automate

MT4 Trading robot Trend followingMean reversionBreakout High risk
Updated 8 months ago None stated GitHub repository of Axuusd Gold Advisor

EA31337 Libre

by EA31337
252 stars

EA31337 Libre is an open-source, multi-strategy trading robot for MetaTrader 4 and MetaTrader 5. It functions as a simplified implementation of the EA31337 framework, providing a collection of over 35 built-in strategies based on technical indicators. The expert advisor performs independent market analysis across vario

MT5 Trading robot Multi-strategyTrend followingMean reversion
Updated 1 year ago GPL-3.0 GitHub repository of EA31337 Libre

Scalpflip EA

by anthonycdp
25 stars

Scalpflip EA is an automated scalping robot for MetaTrader 5 that utilizes a multi-layered technical analysis approach. It offers three entry modes: trend-following, mean-reversion, and a smart mode that selects the strategy based on current market conditions. The system filters trades using the Relative Strength Index

MT5 Trading robot ScalpingTrend followingMean reversion
Updated 1 year ago None stated GitHub repository of Scalpflip 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