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.
Read from Bollinger_Bands_WithTrailStop_EA.mq5. Defaults are the author's; change them in the EA's Inputs tab.
Name
Type
Default
Description
EA_Name
string
Bollinger_Bands_EA
EA Name for comments/logs
RiskPerTradePercent
double
1.0
Risk percentage per trade (e.g., 1.0 for 1%)
StopLossATRMultiplier
double
2.5
Adjusted: Stop Loss as a multiplier of ATR (e.g., 2.5 * ATR)
TakeProfitPips
int
750
Take Profit in pips (from entry price) - Original 1:3 RRR with 250 SL
BBPeriod
int
20
Bollinger Bands Period
BBDeviation
double
2.0
Bollinger Bands Standard Deviations
BBMethod
ENUM_MA_METHOD
MODE_SMA
Bollinger Bands Moving Average Method (kept for clarity in inputs)
BBAppliedPrice
ENUM_APPLIED_PRICE
PRICE_CLOSE
Bollinger Bands Applied Price
SqueezeLookbackBars
int
100
Bars to look back for the lowest Bollinger Band Width
ATRPeriod
int
14
Period for ATR calculation for dynamic SL and candle body check
MinConfirmationBodyATRMultiplier
double
0.3
Minimum confirmation candle body size as a multiplier of ATR
MaxDojiBodyRatio
double
0.1
Max body size relative to range for a Doji (e.g., 0.1 for 10%)
Show all 26 inputs
Name
Type
Default
Description
LongEMAPeriodForRanging
int
200
Period for EMA to check ranging market
MaxEMASlopeForRanging
double
0.00001
Max slope for EMA to consider market ranging (adjust based on symbol's point size)
MinATRForTradingMultiplier
double
0.5
Minimum current ATR (as multiplier of ATR) required for any trade
MaxSqueezeWidthATRMultiplier
double
1.0
Max BB Width (as ATR multiplier) for a squeeze to be considered valid
BreakevenTriggerPips
int
100
Profit in pips to move SL to breakeven
BreakevenBufferPips
int
50
Pips to add to breakeven SL (to cover spread/commission)
MaxLotSize
double
1.0
Maximum lot size to trade
EnableTrading
bool
true
Enable/Disable trading by this EA
MagicNumber
long
223344
Unique ID for Bollinger Bands strategy trades
EnableTrendFollowing
bool
true
Enable/Disable Trend Following Strategy
TrendFastEMAPeriod
int
10
Fast EMA period for Trend Following
TrendSlowEMAPeriod
int
20
Slow EMA period for Trend Following
TrendTrailingStopPips
int
50
Trailing Stop in pips for Trend Following trades (0 to disable)
TrendMagicNumber
long
334455
Unique ID for Trend Following strategy trades
How to Install It
1Download the sourceUse "Download source (.zip)" above, or clone kristsada-cw/Automate-trading from GitHub, and unzip it.
2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
3Copy the filesCopy the .mq5 file into Experts.
4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
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.
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
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
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
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
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
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