Long trades enter on bullish MACD crossovers below the zero line when price is above a trend EMA and ADX exceeds a minimum threshold, with reverse conditions for short trades. Position sizing is calculated from equity risk and ATR stop distance, bounded by a maximum leverage cap. Exits occur at ATR-based stop loss levels, a fixed reward-to-risk profit target, or an optional opposite MACD crossover.
MACD signal line crossover entries
Trend EMA and zero-line pullback filtering
ADX trend strength filter
ATR-based stop loss with fixed reward-to-risk target
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Fast EMA
int
12
fastLen
Slow EMA
int
26
slowLen
Signal EMA
int
9
signalLen
Trend filter (price vs EMA)
bool
true
useTrend
Trend EMA length
int
200
trendLen
Zero-line filter
bool
true
useZero
ADX filter
bool
true
useAdx
ADX length
int
14
adxLen
ADX minimum
float
20.0
adxMin
ATR length
int
14
atrLen
Stop distance (x ATR)
float
2.0
slMult
Reward : Risk
float
2.0
rrRatio
Show all 18 settings
Setting
Type
Default
Variable
Risk per trade (% of equity)
float
1.0
riskPct
Max position size (x equity)
float
1.0
maxLev
Exit on opposite MACD cross
bool
true
exitCross
Allow shorts
bool
true
allowShort
Start date
time
timestamp('01 Jan 2018 00:00 +0000')
startDate
End date
time
timestamp('31 Dec 2069 23:59 +0000')
endDate
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
MACD + Divergences [Alorse] is a momentum strategy that calculates the MACD oscillator and identifies regular and hidden divergences using pivot high and low points. It filters trade signals with dual Exponential Moving Averages (EMA 150 and 600) to ensure tra
This strategy calculates the Moving Average Convergence Divergence indicator and plots the MACD line, signal line, and histogram in a separate pane. It enters long positions when the MACD line crosses above the signal line and enters short positions when it cr
An ADX-based trend-following strategy that enters long positions when the positive directional indicator (DI+) crosses above the Average Directional Index (ADX) while ADX remains below a preset threshold and a fast EMA is above a slow EMA. It allows adding to
This strategy combines an EMA ribbon with MACD confirmation and plots in a separate pane. It enters when ribbon alignment, optional MACD zero or signal crosses, volume, smart-money, and multi-timeframe filters agree, then exits with percentage stop loss and ta
This strategy evaluates the dynamic relationship between price and a chosen moving average across six diagnostic dimensions: trend, respect, extension, compression, acceleration, and exhaustion. It plots a normalized relationship oscillator bounded between -10
This strategy combines the Moving Average Convergence Divergence oscillator with an Exponential Moving Average trend filter. It enters long positions when the MACD histogram crosses above zero while price stays above the long-term EMA filter. Long trades close