MACD (Moving Average Convergence Divergence)
The MACD is one of the most popular technical indicators, combining trend-following and momentum analysis. It shows the relationship between two moving averages and helps identify trend direction, momentum shifts, and potential entry/exit points.
How it works: The MACD Line is the difference between a fast EMA and a slow EMA. The Signal Line is an EMA of the MACD Line. The histogram visualizes the distance between the MACD Line and Signal Line.
Resources: TradingView MACD docs
Settings in block algo flex
| Setting | Description | Default |
|---|---|---|
| Use MACD? | Enable/disable the indicator | Off |
| Fast Length | Periods for the fast moving average | 12 |
| Slow Length | Periods for the slow moving average | 26 |
| Source | Price component for calculation | close |
| Signal Smoothing | EMA period for the Signal Line | 9 |
| Oscillator MA Type | Moving average type for the MACD Line | EMA |
| Signal Line MA Type | Moving average type for the Signal Line | EMA |
| Timeframe | Timeframe for calculation | Chart |
| Buy Line Condition | MACD Line threshold (e.g., "Less Than 0") | Less Than 0 |
| Sell Line Condition | MACD Line threshold (e.g., "Greater Than 0") | Greater Than 0 |
| Buy Condition | Crossover event (MACD crosses above Signal) | Crossover |
| Sell Condition | Crossunder event (MACD crosses below Signal) | Crossunder |
How to Interpret
- MACD crosses above Signal Line — Bullish momentum, potential buy
- MACD crosses below Signal Line — Bearish momentum, potential sell
- MACD above zero — Bullish trend bias
- MACD below zero — Bearish trend bias
- Histogram expanding — Momentum is increasing
- Histogram contracting — Momentum is fading
Pro Tip: Combining the line condition (above/below zero) with the crossover condition gives you a two-layer filter: you only take bullish crossovers when MACD is already below zero (buying into a reversal), or when above zero (trading with the trend). Experiment with both approaches.