Indicator · Pine Script v5 · Own pane

Jerry MACD

by g-moe· code credited to goodgains

Jerry MACD is a momentum oscillator indicator displayed in a separate pane.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code104
Settings26inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 2026

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

104 lines of Pine Script v5 from Tradingview/jerry-macd.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

jerry-macd.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("Jerry_MACD", overlay = false)

// @keywords: jerry-macd, macd-histogram, signal-line, per-symbol-threshold, zero-line-cross, bullish-bearish-labels, symbol-mapping, custom-entry-level, histogram-columns, crossover-signal, dashboard-table, macd-settings, histogram-bubbles, multi-symbol-config, momentum-oscillator, pane-indicator, fast-slow-signal, symbol-dashboard, histogram-cross, entry-threshold

// symbol settings
other_entry = input.float(0.01, title = 'All Other Symbols         ', group = 'Symbols', inline = '1', step = 0.1)


input_symbol1 = input.symbol('SPY', title = 'Symbol 1', group = 'Symbols', inline = '2')
symbol1_entry = input.float(0.30, title = '', group = 'Symbols', inline = '2', step = 0.1)

input_symbol2 = input.symbol('QQQ', title = 'Symbol 2', group = 'Symbols', inline = '3')
symbol2_entry = input.float(0.25, title = '', group = 'Symbols', inline = '3', step = 0.1)

input_symbol3 = input.symbol('IWM', title = 'Symbol 3', group = 'Symbols', inline = '4')
symbol3_entry = input.float(0.15, title = '', group = 'Symbols', inline = '4', step = 0.1)

input_symbol4 = input.symbol('TSLA', title = 'Symbol 4', group = 'Symbols', inline = '5')
symbol4_entry = input.float(0.5, title = '', group = 'Symbols', inline = '5', step = 0.1)

input_symbol5 = input.symbol('AAPL', title = 'Symbol 5', group = 'Symbols', inline = '6')
symbol5_entry = input.float(0.5, title = '', group = 'Symbols', inline = '6', step = 0.1)

input_symbol6 = input.symbol('AAPL', title = 'Symbol 6', group = 'Symbols', inline = '7')
symbol6_entry = input.float(0.5, title = '', group = 'Symbols', inline = '7', step = 0.1)

input_symbol7 = input.symbol('AAPL', title = 'Symbol 7', group = 'Symbols', inline = '8')
symbol7_entry = input.float(0.5, title = '', group = 'Symbols', inline = '8', step = 0.1)

input_symbol8 = input.symbol('AAPL', title = 'Symbol 8', group = 'Symbols', inline = '9')
symbol8_entry = input.float(0.5, title = '', group = 'Symbols', inline = '9', step = 0.1)

input_symbol9 = input.symbol('AAPL', title = 'Symbol 9', group = 'Symbols', inline = '10')
symbol9_entry = input.float(0.5, title = '', group = 'Symbols', inline = '10', step = 0.1)

input_symbol10 = input.symbol('AAPL', title = 'Symbol 10', group = 'Symbols', inline = '11')
symbol10_entry = input.float(0.5, title = '', group = 'Symbols', inline = '11', step = 0.1)


// macd settings
macd_fastlength = input.int(12, title = 'Fast Length ', group = 'MACD Settings', inline = '1')
macd_slowlength = input.int(26, title = 'Slow Length ', group = 'MACD Settings', inline = '2')
macd_length = input.int(5, title = 'MACD Length', group = 'MACD Settings', inline = '3')


// function to calculate macd
[macdLine, signalLine, histLine] = ta.macd(close, macd_fastlength, macd_slowlength, macd_length)

map_symbol = syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol1)  ? 1 :
     syminfo.ticker(syminfo.tickerid)  == syminfo.ticker(input_symbol2)  ? 2 :
     syminfo.ticker(syminfo.tickerid)  == syminfo.ticker(input_symbol3)  ? 3 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol4)  ? 4 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol5)  ? 5 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol6)  ? 6 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol7)  ? 7 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol8)  ? 8 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol9)  ? 9 :
     syminfo.ticker(syminfo.tickerid) == syminfo.ticker(input_symbol10)  ? 10 :
      0

ZeroLine_Positive = map_symbol == 1 ? symbol1_entry : 
     map_symbol == 2 ? symbol2_entry :
     map_symbol == 3 ? symbol3_entry :
     map_symbol == 4 ? symbol4_entry :
     map_symbol == 5 ? symbol5_entry :
     map_symbol == 6 ? symbol6_entry :
     map_symbol == 7 ? symbol7_entry :
     map_symbol == 8 ? symbol8_entry :
     map_symbol == 9 ? symbol9_entry :
     map_symbol == 10 ? symbol10_entry :
      other_entry

plot(ZeroLine_Positive, "+ Zero Line", color=color.new(#787B86, 0))
plot(-ZeroLine_Positive, "- Zero Line", color=color.new(#787B86, 0))
plot(histLine, title="Histogram", style=plot.style_columns, color=(histLine>=0 ? (histLine[1] < histLine ? color.new(#26A69A,0) : color.new(#B2DFDB,0)) : (histLine[1] < histLine ? color.new(#FF5252,0) : color.new(#FFCDD2,0))))
plot(macdLine, title="MACD", color=color.new(#2962FF,0))
plot(signalLine, title="Signal", color=color.new(#FF6D00,0))

show_signal_bubbles = input.bool(true, title = 'Show Signal Bubbles', group = 'MACD Settings', inline = '4')
upsignal = ta.crossover(histLine, ZeroLine_Positive)
downsignal = ta.crossunder(histLine, -ZeroLine_Positive)
plotshape(show_signal_bubbles and upsignal ? macdLine : na, title = 'Bearish', location = location.absolute, color = color.red,
      text = 'Bearish', style = shape.labeldown, textcolor = color.white)
plotshape(show_signal_bubbles and downsignal ? macdLine : na, title = 'Bullish', location = location.absolute, color = color.green,
      text = 'Bullish', style = shape.labelup, textcolor = color.white)
     
LabelSize = input.string(defval="small", options=["small", "medium", "large"], group = "Dashboard Settings", title = "Label Size", inline = '1')
label_size = LabelSize == "small" ? size.small : LabelSize == "medium" ? size.normal : LabelSize == "large" ? size.large : size.small

var table = table.new(position = position.bottom_right, columns = 4, rows = 1, border_width = 1)
if barstate.islast
    table.cell(table_id = table, column = 0, row = 0, text = "CHART SYMBOL: " + str.tostring(syminfo.ticker) + " #" + str.tostring(map_symbol),
     bgcolor = color.yellow, text_color = color.black, text_size = label_size)

    table.cell(table_id = table, column = 1, row = 0, text = histLine > 0 ? "MACD BULLISH" : histLine < 0 ? "MACD BEARISH" : "",
      bgcolor = histLine > 0 ? color.green : histLine < 0 ? color.red : color.black, text_color = color.black, text_size = label_size)

    table.cell(table_id = table, column = 2, row = 0, text = "Best " + str.tostring(syminfo.ticker) + " signals are near zero & dash lines",
     bgcolor = color.white, text_color = color.black, text_size = label_size)

Overview

Jerry MACD calculates a standard Moving Average Convergence Divergence line, signal line, and histogram using fast, slow, and signal lengths. The indicator features symbol-specific entry threshold mapping, allowing users to define custom threshold trigger levels for up to ten individual ticker symbols or use a default value for unlisted instruments. It generates visual signal bubbles on the chart when histogram threshold conditions are met. Users can customize MACD parameters, symbol threshold mappings, and label formatting.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Moving averages

Markets

Stocks

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.

Settings

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

SettingTypeDefaultVariable
All Other Symbols         float0.01other_entry
Symbol 1symbolSPYinput_symbol1
symbol1_entryfloat0.30symbol1_entry
Symbol 2symbolQQQinput_symbol2
symbol2_entryfloat0.25symbol2_entry
Symbol 3symbolIWMinput_symbol3
symbol3_entryfloat0.15symbol3_entry
Symbol 4symbolTSLAinput_symbol4
symbol4_entryfloat0.5symbol4_entry
Symbol 5symbolAAPLinput_symbol5
symbol5_entryfloat0.5symbol5_entry
Symbol 6symbolAAPLinput_symbol6
Show all 26 settings
SettingTypeDefaultVariable
symbol6_entryfloat0.5symbol6_entry
Symbol 7symbolAAPLinput_symbol7
symbol7_entryfloat0.5symbol7_entry
Symbol 8symbolAAPLinput_symbol8
symbol8_entryfloat0.5symbol8_entry
Symbol 9symbolAAPLinput_symbol9
symbol9_entryfloat0.5symbol9_entry
Symbol 10symbolAAPLinput_symbol10
symbol10_entryfloat0.5symbol10_entry
Fast Length int12macd_fastlength
Slow Length int26macd_slowlength
MACD Lengthint5macd_length
Show Signal Bubblesbooltrueshow_signal_bubbles
Label SizestringsmallLabelSize
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

948 stars

The Derivative Oscillator calculates a double-exponentially smoothed Relative Strength Index (RSI) and subtracts its Simple Moving Average (SMA) to form the main oscillator line. A secondary signal line is plotted using an SMA of the main oscillator values. Th

Indicator v4 Oscillators & momentumMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Derivative Oscillator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

MACD

by Alorse
330 stars

This indicator calculates and plots the standard Moving Average Convergence Divergence oscillator in a separate pane. It computes the difference between a fast and slow moving average, derives a signal line through smoothing, and plots a histogram representing

Indicator v4 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of MACD

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It 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 us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama

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