Indicator · Pine Script v5 · Own pane

MACD-V

by harryguiacorn· code credited to Coded by Harry Gui

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou.

View on GitHub

GitHub stars219on the repository
Pine versionv5runs as is
Lines of code35
Settings7inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago8 May 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

35 lines of Pine Script v5 from MACD-V.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

MACD-V.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @ Paper by Alex Spiroglou
// © Coded by Harry Gui

//@version=5
indicator("MACD-V", overlay=false)

// Input parameters
fastLength = input(12, title="Fast EMA Length")
slowLength = input(26, title="Slow EMA Length")
signalLength = input(9, title="Signal Length")
atrLength = input(26, title="ATR Length")
overbought = input(40, title="Overbought")
oversold = input(-40, title="Oversold")

// Calculate ATR
atr = ta.atr(atrLength)

[macdLine, signalLine, histLine] = ta.macd(close, fastLength, slowLength, signalLength)
// plot(macdLine/atr, color=color.blue)
// plot(signalLine/atr, color=color.orange)
macdv = histLine/atr*100
plot(macdv, title = "Histogram", style = plot.style_columns, color = (macdv >= 0 ? (macdv[1] < macdv ? #26A69A : #B2DFDB) : (macdv[1] < macdv ? #FFCDD2 : #FF5252)))

hline(0, title = "0.0")
hline(overbought, title = "Overbought")
hline(oversold, title = "Oversold")

plotshape(macdv < oversold ? macdv * 1.1 : na, "MACD-V Oversold", shape.circle, location = location.absolute, color = color.new(color.fuchsia, 0))
plotshape(macdv > overbought ? macdv * 1.1 : na, "MACD-V Overbought", shape.circle, location = location.absolute, color = color.new(color.fuchsia, 0))

// Highlight chart background between specific hours
display_hours_highlight = input(false, "Display background colours for specific hours")
t1 = time(timeframe.period, "1000-1300,1600-2000,2400-0700:23456", "Europe/London")
bgcolor(not na(t1) ? color.new(color.silver, 90) : na, display = display_hours_highlight? display.all: display.none)

Overview

MACD-V calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes user-defined overbought and oversold reference lines. Fuchsia circle shapes mark when momentum crosses extreme volatility threshold levels. It also includes an optional background highlight for specific London trading sessions.

Details

Published by

harryguiacorn on GitHub

Code credit

Coded by Harry Gui, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volatility & bands, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

bollingerbollinger-bandbollinger-bandsichimokuichimoku-cloudichimoku-indicatorpinepinescriptpinescript-guidespinescript-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Fast EMA Lengthint12fastLength
Slow EMA Lengthint26slowLength
Signal Lengthint9signalLength
ATR Lengthint26atrLength
Overboughtint40overbought
Oversoldint-40oversold
Display background colours for specific hoursboolfalsedisplay_hours_highlight
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.

Similar Pine Scripts

MultiIndicator

by capissimo
114 stars

MultiIndicator combines multiple technical indicators into a single separate pane to save chart space. It calculates and displays market regime detection based on ordinary least squares regression, a Holt exponential smoothing crossover, normalized RSI, ADX, a

Indicator v4 Oscillators & momentumTrend
Updated 1 year ago · None stated GitHub repository of MultiIndicator

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

This indicator plots a relative strength index in a separate pane. It calculates RSI from the average of the previous ten opens rather than the current bar, so that source does not change during the live candle. A moving average of the RSI is plotted and can b

Indicator v5 Oscillators & momentumMoving averages
Updated 2 years ago · None stated GitHub repository of No Repaint - Relative Strength Index
29 stars

The Supertrended RSI [AlgoAlpha] indicator plots the Relative Strength Index combined with a Supertrend overlay in a separate indicator pane. It first computes standard RSI, with an optional Hull Moving Average smoothing step, and computes a secondary moving a

Indicator v5 Oscillators & momentumTrend
Updated 11 months ago · Custom licence GitHub repository of Supertrended RSI [AlgoAlpha]

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers