Fast EMA above Slow EMA with MACD
Dec 7, 2022

The Fast EMA above Slow EMA with MACD indicator tool provides a trend-following momentum strategy that combines moving average crossovers with histogram confirmation to identify high-probability entry points.
Usage
The indicator is primarily used to identify long entries in trending markets. A long signal is generated when two specific conditions align: the Fast EMA (8-period) is positioned above the Slow EMA (26-period), and the MACD line crosses above the signal line (indicated by the histogram turning bullish).
For example, on lower timeframes like the 5-minute chart for volatile assets, this tool can help capture quick momentum shifts. The script also includes built-in trailing stop-loss and take-profit mechanisms to manage exits dynamically as price fluctuates.
Details
This script integrates two classic technical analysis concepts:
- Exponential Moving Averages (EMA): Unlike simple moving averages, EMAs place more weight on recent price data, allowing the indicator to react faster to current market trends.
- Moving Average Convergence Divergence (MACD): This momentum oscillator tracks the relationship between two EMAs (typically 12 and 26). The script looks for the specific moment the MACD line crosses the signal line while the broader trend (defined by the 8/26 EMA relationship) is bullish.
The strategy implementation includes a 0.1% commission fee and uses a percentage of equity for position sizing to provide a more realistic simulation of live trading environments.
Settings
- Show Date Range: Toggles the visibility of the backtesting period start date (defaulted to January 1, 2022).
- Trail Long Loss (%): Sets the trailing stop-loss percentage for long positions to protect capital during pullbacks.
- Trail Short Loss (%): Sets the trailing profit or stop-limit percentage to lock in gains or limit upside risk in specific scenarios.
FAQ
How do I interpret the EMA lines on the chart?
The Fast EMA (blue) and Slow EMA (green) represent short-term and medium-term trends respectively. When the Fast EMA is above the Slow EMA, the script considers the primary trend to be bullish.
What timeframes work best for this script?
While it can be used on any timeframe, it is particularly effective on shorter intervals like the 5-minute or 15-minute charts for capturing intraday momentum.
How can I access this tool?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.