# Adaptive MACD

Adaptive MACD is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Adaptive MACD reshapes the classic momentum gauge by market regime: a rolling R-squared reading blends the filter toward trend preservation when price trends and toward cycle detection when it ranges. The MACD line, signal line, and histogram read exactly as traders expect, designed to sit quiet through chop while keeping full divergence duty.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Aug 21, 2023.
- Access: free.
- Concepts: [MACD](https://www.luxalgo.com/library/concept/macd/) (primary), [Adaptive Parameterization](https://www.luxalgo.com/library/concept/adaptive-parameterization/)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=cmpwn008h0004vhsge95nnq9i
- Page: https://www.luxalgo.com/library/indicator/adaptive-macd/

**Adaptive MACD** rebuilds [MACD](https://www.luxalgo.com/library/concept/macd/) for markets that refuse to stay trending. A rolling R-squared coefficient continuously measures how directional price has been, and that reading drives a blending weight that reshapes the filter itself: high values keep it close to the traditional calculation and preserve long-term trends, low values shift it toward short-cycle detection so consolidation stops printing false momentum. The familiar anatomy survives intact: MACD line, signal line, histogram.

## How to Trade the Adaptive MACD?

- **MACD line above 0**: bullish momentum in force; below 0, the downtrend read applies.
- **Histogram**: the gap between MACD and signal lines. Watch it for crossovers and transitions in momentum.
- **Divergences**: highs or lows in price left unconfirmed by the oscillator flag potential reversals, read exactly as on the classic.

With matched fast and slow lengths, the adaptive version reacts to genuine structural change while filtering range noise: [adaptive parameterization](https://www.luxalgo.com/library/concept/adaptive-parameterization/) doing the regime work a fixed filter cannot.

## Adaptive MACD Settings

- **R2 Period**: observation window for the R-squared coefficient; larger periods classify trend versus range on a broader horizon.
- **Fast**: the short EMA interval. Lower values sharpen sensitivity.
- **Slow**: the long EMA interval. Higher values weight prolonged moves.
- **Signal**: smoothing applied to derive the signal line from the MACD line.

## Frequently Asked Questions

### When does it behave differently from the classic MACD?

In sideways conditions. While the market trends, the high R-squared reading keeps it near traditional behavior; when direction fades, the filter leans cyclical and screens out the whipsaws a fixed-parameter MACD prints in consolidation.

### Which traders is it built for?

Momentum and swing traders who want fewer noise signals in range-bound stretches, and systematic users who need one oscillator that adjusts to market structure instead of maintaining two tuned variants. If lag bothers you more than noise, [Zero Lag MACD](https://www.luxalgo.com/library/indicator/zero-lag-macd/) attacks that trade-off instead.

### How do I access the Adaptive MACD?

Adaptive MACD is free on the LuxAlgo Library. From this page you can also open it in Quant, our coding agent, and experiment with the R2 Period on your usual markets. You can also copy the source code from this page and run it anywhere Pine Script® runs.

## Related indicators

- [MACD Based Price Forecasting](https://www.luxalgo.com/library/indicator/macd-based-price-forecasting/) (MACD): markdown at https://www.luxalgo.com/library/indicator/macd-based-price-forecasting.md
- [MACD](https://www.luxalgo.com/library/indicator/macd/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/macd.md
- [Signals & Overlays](https://www.luxalgo.com/library/indicator/luxalgo-signals-overlays/) (Adaptive Parameterization): markdown at https://www.luxalgo.com/library/indicator/luxalgo-signals-overlays.md
- [Indicator Configuration Forecasting](https://www.luxalgo.com/library/indicator/indicator-configuration-forecasting/) (Adaptive Parameterization): markdown at https://www.luxalgo.com/library/indicator/indicator-configuration-forecasting.md
- [Volume-weighted MACD](https://www.luxalgo.com/library/indicator/volume-weighted-macd/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/volume-weighted-macd.md
- [Impulse MACD](https://www.luxalgo.com/library/indicator/impulse-macd/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/impulse-macd.md
- [MACD-V](https://www.luxalgo.com/library/indicator/macd-v/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/macd-v.md
- [Schaff Trend Cycle](https://www.luxalgo.com/library/indicator/schaff-trend-cycle/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/schaff-trend-cycle.md

---

Source: https://www.luxalgo.com/library/indicator/adaptive-macd/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
