OPEN-SOURCE SCRIPT
MACD + RSI + MFI + A/D by Ismael

█ OVERVIEW
A 4-in-1 oscillator panel combining MACD, RSI with Bollinger Bands and
custom Buy/Sell signals, Money Flow Index (MFI), and Accumulation/Distribution.
Each module can be toggled on/off independently from a single "Toggle
Indicators" group, so the user can display only what they need instead of
loading four separate scripts.
═══════════════════════════════════════════════════════════════════════
█ ORIGINALITY
This script does not invent new math — it integrates four well-known
built-in indicators into a single pane and adds three conveniences:
- A unified toggle system to show/hide each indicator on demand.
- A custom RSI signal layer based on Bollinger Band breakouts of the
RSI itself, combined with the classic overbought/oversold zones.
- An A/D module that replicates the configuration style of the
MetaTrader 5 implementation (Tick/Real volume option and configurable
horizontal levels).
═══════════════════════════════════════════════════════════════════════
█ WHAT IT INCLUDES
▪ MACD (default: ON)
Standard MACD with configurable fast/slow lengths, signal smoothing,
and choice of SMA or EMA for both the oscillator and signal line.
Includes alerts for histogram polarity changes.
▪ RSI with Bollinger Bands and Buy/Sell signals (default: ON)
Classic RSI with optional smoothing MA (SMA, EMA, WMA, VWMA, SMMA,
or SMA + Bollinger Bands). When "SMA + Bollinger Bands" is selected:
- Buy signal: RSI closes below its lower Bollinger Band AND below 30.
- Sell signal: RSI closes above its upper Bollinger Band AND above 70.
Signals are plotted as arrows and include alert conditions.
▪ MFI (default: OFF)
Standard Money Flow Index with 80/50/20 horizontal levels.
▪ Accumulation/Distribution (default: OFF)
Classic cumulative A/D line. Configurable like the MT5 version:
- Volume mode: Real or Tick (1 per bar, useful for FX).
- 3 user-defined horizontal levels with individual visibility/color.
- Color and line width.
Includes alerts for crossovers against its own SMA(20).
═══════════════════════════════════════════════════════════════════════
█ HOW TO USE
1. Activate from "Toggle Indicators" only the modules you need.
2. RSI Buy/Sell signals are intended as confluence — not standalone
entries. They mark statistically rare conditions (extreme RSI combined
with a Bollinger Band breakout on the RSI) and should be confirmed
with price action, structure, or trend context.
3. MACD histogram polarity alerts can be paired with RSI signals.
4. The A/D line is most useful when watched for divergences against price,
not for its absolute value.
═══════════════════════════════════════════════════════════════════════
█ LIMITATIONS
- The A/D line uses cumulative values that produce very large numbers.
When combined with MACD/RSI/MFI in the same pane, auto-scale will
compress the smaller-range indicators. Workaround: right-click the
A/D plot → "Pin to scale" → assign it to a separate scale.
- "Tick" volume here is approximated as 1 per bar; Pine Script does not
expose the tick-volume data used by MetaTrader 5. For instruments with
reliable real volume, use "Real".
- RSI Buy/Sell signals only fire when the smoothing MA type is set to
"SMA + Bollinger Bands". Other MA types disable the signal layer.
- This is an aggregator/utility script. It does not predict market
direction and is not a complete trading system.
═══════════════════════════════════════════════════════════════════════
█ DISCLAIMER
This script is shared for educational purposes only and is not financial
advice. Indicator signals do not guarantee future results. Always perform
your own analysis and apply proper risk management.
═══════════════════════════════════════════════════════════════════════
█ DESCRIPCIÓN (Español)
Panel de osciladores 4-en-1 que combina MACD, RSI con Bandas de Bollinger
y señales de compra/venta, MFI y Acumulación/Distribución. Cada módulo se
activa o desactiva de forma independiente desde el grupo "Toggle
Indicators".
Incluye:
- MACD estándar con alertas de cambio de polaridad del histograma.
- RSI con MA opcional (SMA, EMA, WMA, VWMA, SMMA o SMA+BB). Cuando
se elige "SMA + Bandas de Bollinger", aparecen señales:
- Compra: RSI por debajo de la banda inferior Y menor a 30.
- Venta: RSI por encima de la banda superior Y mayor a 70.
- MFI estándar con niveles 80/50/20.
- Acumulación/Distribución estilo MT5: volumen Real/Tick, 3 niveles
horizontales configurables, color y grosor ajustables, alertas de
cruce contra su SMA(20).
Las señales del RSI son herramientas de confluencia, no entradas
automáticas. La línea A/D se interpreta principalmente por divergencias
con el precio, no por su valor absoluto. Al activar A/D junto con los
demás osciladores, conviene moverla a una escala separada (clic derecho
sobre la línea → "Fijar a escala" → escala nueva).
Este script tiene fines educativos. No constituye asesoría financiera.
█ HOW TO USE
The RSI Buy/Sell signals (with their attached alerts) are the main
actionable element of this script and can be used to anticipate potential
entries — long on Buy signals, short on Sell signals. They fire under
statistically rare conditions (RSI breaking out of its own Bollinger Band
envelope while also being in extreme oversold/overbought territory),
which often precede a reversion or a meaningful move.
However, these signals should NOT be taken as standalone entries. They
work best as an early-warning system that must be confirmed before
acting on them. Recommended workflow:
1. RSI Buy/Sell signal fires → set alert and prepare the trade idea.
2. Look at the MACD for confirmation:
- For a Buy: histogram should be turning from falling to rising,
or MACD line crossing above Signal.
- For a Sell: histogram turning from rising to falling, or MACD
line crossing below Signal.
3. Check the MFI (if enabled): values pulling back from oversold (<20)
on Buys, or pulling back from overbought (>80) on Sells, add
confluence by confirming a money-flow shift.
4. Check the A/D line for divergences with price:
- Bullish divergence (price makes lower low, A/D makes higher low)
strongly supports a Buy signal.
- Bearish divergence (price makes higher high, A/D makes lower
high) strongly supports a Sell signal.
Divergences on RSI itself against price work the same way and are
one of the most reliable confirmation tools in this panel.
5. Always combine with price-action context: trend direction on higher
timeframes, key support/resistance, and your own risk management.
In short: the RSI signals are designed to ANTICIPATE trades, not to
trigger them automatically. The other modules (MACD, MFI, A/D) and
divergence analysis exist to filter the false positives and validate
the ones worth taking.
═══════════════════════════════════════════════════════════════════════
█ CÓMO USAR (Español)
Las señales de Compra/Venta del RSI (con sus alertas configuradas) son
el elemento principal accionable de este script y pueden usarse para
anticipar entradas — largos en señales de Compra, cortos en señales de
Venta. Se activan en condiciones estadísticamente poco frecuentes
(el RSI rompe su propia envolvente de Bandas de Bollinger mientras
está en zona de sobreventa o sobrecompra extrema), que suelen preceder
una reversión o un movimiento significativo.
Sin embargo, NO deben tomarse como entradas automáticas. Funcionan
mejor como un sistema de alerta temprana que debe confirmarse antes
de operar. Flujo recomendado:
1. Se dispara la señal del RSI → preparar la idea de trade.
2. Confirmar con MACD:
- Compra: histograma pasando de bajista a alcista, o cruce
del MACD por encima de la Signal.
- Venta: histograma pasando de alcista a bajista, o cruce
del MACD por debajo de la Signal.
3. Confirmar con MFI (si está activo): valores saliendo de
sobreventa (<20) en Compras o saliendo de sobrecompra (>80)
en Ventas indican un cambio en el flujo de dinero.
4. Buscar divergencias en la línea A/D contra el precio:
- Divergencia alcista (precio hace mínimo más bajo, A/D hace
mínimo más alto) refuerza una señal de Compra.
- Divergencia bajista (precio hace máximo más alto, A/D hace
máximo más bajo) refuerza una señal de Venta.
Las divergencias del propio RSI contra el precio funcionan igual
y son una de las confirmaciones más fiables de este panel.
5. Siempre combinar con contexto de price action: tendencia en
temporalidades superiores, soportes/resistencias clave y gestión
de riesgo propia.
En resumen: las señales del RSI están diseñadas para ANTICIPAR
trades, no para dispararlos automáticamente. Los otros módulos
(MACD, MFI, A/D) y el análisis de divergencias existen para filtrar
los falsos positivos y validar las entradas que realmente valen
la pena.
A 4-in-1 oscillator panel combining MACD, RSI with Bollinger Bands and
custom Buy/Sell signals, Money Flow Index (MFI), and Accumulation/Distribution.
Each module can be toggled on/off independently from a single "Toggle
Indicators" group, so the user can display only what they need instead of
loading four separate scripts.
═══════════════════════════════════════════════════════════════════════
█ ORIGINALITY
This script does not invent new math — it integrates four well-known
built-in indicators into a single pane and adds three conveniences:
- A unified toggle system to show/hide each indicator on demand.
- A custom RSI signal layer based on Bollinger Band breakouts of the
RSI itself, combined with the classic overbought/oversold zones.
- An A/D module that replicates the configuration style of the
MetaTrader 5 implementation (Tick/Real volume option and configurable
horizontal levels).
═══════════════════════════════════════════════════════════════════════
█ WHAT IT INCLUDES
▪ MACD (default: ON)
Standard MACD with configurable fast/slow lengths, signal smoothing,
and choice of SMA or EMA for both the oscillator and signal line.
Includes alerts for histogram polarity changes.
▪ RSI with Bollinger Bands and Buy/Sell signals (default: ON)
Classic RSI with optional smoothing MA (SMA, EMA, WMA, VWMA, SMMA,
or SMA + Bollinger Bands). When "SMA + Bollinger Bands" is selected:
- Buy signal: RSI closes below its lower Bollinger Band AND below 30.
- Sell signal: RSI closes above its upper Bollinger Band AND above 70.
Signals are plotted as arrows and include alert conditions.
▪ MFI (default: OFF)
Standard Money Flow Index with 80/50/20 horizontal levels.
▪ Accumulation/Distribution (default: OFF)
Classic cumulative A/D line. Configurable like the MT5 version:
- Volume mode: Real or Tick (1 per bar, useful for FX).
- 3 user-defined horizontal levels with individual visibility/color.
- Color and line width.
Includes alerts for crossovers against its own SMA(20).
═══════════════════════════════════════════════════════════════════════
█ HOW TO USE
1. Activate from "Toggle Indicators" only the modules you need.
2. RSI Buy/Sell signals are intended as confluence — not standalone
entries. They mark statistically rare conditions (extreme RSI combined
with a Bollinger Band breakout on the RSI) and should be confirmed
with price action, structure, or trend context.
3. MACD histogram polarity alerts can be paired with RSI signals.
4. The A/D line is most useful when watched for divergences against price,
not for its absolute value.
═══════════════════════════════════════════════════════════════════════
█ LIMITATIONS
- The A/D line uses cumulative values that produce very large numbers.
When combined with MACD/RSI/MFI in the same pane, auto-scale will
compress the smaller-range indicators. Workaround: right-click the
A/D plot → "Pin to scale" → assign it to a separate scale.
- "Tick" volume here is approximated as 1 per bar; Pine Script does not
expose the tick-volume data used by MetaTrader 5. For instruments with
reliable real volume, use "Real".
- RSI Buy/Sell signals only fire when the smoothing MA type is set to
"SMA + Bollinger Bands". Other MA types disable the signal layer.
- This is an aggregator/utility script. It does not predict market
direction and is not a complete trading system.
═══════════════════════════════════════════════════════════════════════
█ DISCLAIMER
This script is shared for educational purposes only and is not financial
advice. Indicator signals do not guarantee future results. Always perform
your own analysis and apply proper risk management.
═══════════════════════════════════════════════════════════════════════
█ DESCRIPCIÓN (Español)
Panel de osciladores 4-en-1 que combina MACD, RSI con Bandas de Bollinger
y señales de compra/venta, MFI y Acumulación/Distribución. Cada módulo se
activa o desactiva de forma independiente desde el grupo "Toggle
Indicators".
Incluye:
- MACD estándar con alertas de cambio de polaridad del histograma.
- RSI con MA opcional (SMA, EMA, WMA, VWMA, SMMA o SMA+BB). Cuando
se elige "SMA + Bandas de Bollinger", aparecen señales:
- Compra: RSI por debajo de la banda inferior Y menor a 30.
- Venta: RSI por encima de la banda superior Y mayor a 70.
- MFI estándar con niveles 80/50/20.
- Acumulación/Distribución estilo MT5: volumen Real/Tick, 3 niveles
horizontales configurables, color y grosor ajustables, alertas de
cruce contra su SMA(20).
Las señales del RSI son herramientas de confluencia, no entradas
automáticas. La línea A/D se interpreta principalmente por divergencias
con el precio, no por su valor absoluto. Al activar A/D junto con los
demás osciladores, conviene moverla a una escala separada (clic derecho
sobre la línea → "Fijar a escala" → escala nueva).
Este script tiene fines educativos. No constituye asesoría financiera.
█ HOW TO USE
The RSI Buy/Sell signals (with their attached alerts) are the main
actionable element of this script and can be used to anticipate potential
entries — long on Buy signals, short on Sell signals. They fire under
statistically rare conditions (RSI breaking out of its own Bollinger Band
envelope while also being in extreme oversold/overbought territory),
which often precede a reversion or a meaningful move.
However, these signals should NOT be taken as standalone entries. They
work best as an early-warning system that must be confirmed before
acting on them. Recommended workflow:
1. RSI Buy/Sell signal fires → set alert and prepare the trade idea.
2. Look at the MACD for confirmation:
- For a Buy: histogram should be turning from falling to rising,
or MACD line crossing above Signal.
- For a Sell: histogram turning from rising to falling, or MACD
line crossing below Signal.
3. Check the MFI (if enabled): values pulling back from oversold (<20)
on Buys, or pulling back from overbought (>80) on Sells, add
confluence by confirming a money-flow shift.
4. Check the A/D line for divergences with price:
- Bullish divergence (price makes lower low, A/D makes higher low)
strongly supports a Buy signal.
- Bearish divergence (price makes higher high, A/D makes lower
high) strongly supports a Sell signal.
Divergences on RSI itself against price work the same way and are
one of the most reliable confirmation tools in this panel.
5. Always combine with price-action context: trend direction on higher
timeframes, key support/resistance, and your own risk management.
In short: the RSI signals are designed to ANTICIPATE trades, not to
trigger them automatically. The other modules (MACD, MFI, A/D) and
divergence analysis exist to filter the false positives and validate
the ones worth taking.
═══════════════════════════════════════════════════════════════════════
█ CÓMO USAR (Español)
Las señales de Compra/Venta del RSI (con sus alertas configuradas) son
el elemento principal accionable de este script y pueden usarse para
anticipar entradas — largos en señales de Compra, cortos en señales de
Venta. Se activan en condiciones estadísticamente poco frecuentes
(el RSI rompe su propia envolvente de Bandas de Bollinger mientras
está en zona de sobreventa o sobrecompra extrema), que suelen preceder
una reversión o un movimiento significativo.
Sin embargo, NO deben tomarse como entradas automáticas. Funcionan
mejor como un sistema de alerta temprana que debe confirmarse antes
de operar. Flujo recomendado:
1. Se dispara la señal del RSI → preparar la idea de trade.
2. Confirmar con MACD:
- Compra: histograma pasando de bajista a alcista, o cruce
del MACD por encima de la Signal.
- Venta: histograma pasando de alcista a bajista, o cruce
del MACD por debajo de la Signal.
3. Confirmar con MFI (si está activo): valores saliendo de
sobreventa (<20) en Compras o saliendo de sobrecompra (>80)
en Ventas indican un cambio en el flujo de dinero.
4. Buscar divergencias en la línea A/D contra el precio:
- Divergencia alcista (precio hace mínimo más bajo, A/D hace
mínimo más alto) refuerza una señal de Compra.
- Divergencia bajista (precio hace máximo más alto, A/D hace
máximo más bajo) refuerza una señal de Venta.
Las divergencias del propio RSI contra el precio funcionan igual
y son una de las confirmaciones más fiables de este panel.
5. Siempre combinar con contexto de price action: tendencia en
temporalidades superiores, soportes/resistencias clave y gestión
de riesgo propia.
En resumen: las señales del RSI están diseñadas para ANTICIPAR
trades, no para dispararlos automáticamente. Los otros módulos
(MACD, MFI, A/D) y el análisis de divergencias existen para filtrar
los falsos positivos y validar las entradas que realmente valen
la pena.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.