Indicator · Pine Script v5 · Own pane

MACD Bands - Multi Timeframe [TradeMaster Lite]

by jash-git· code credited to trademasterindicator.

This indicator calculates a multi-timeframe MACD line alongside signal lines and volatility bands in a separate chart pane.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code84
Settings7inputs
LicenceNone statedfile: MPL-2.0
Last update4 weeks ago26 Sep 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

84 lines of Pine Script v5 from jash_GGMA_Granville_20250104/MACD Bands - Multi Timeframe [TradeMaster Lite].txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

MACD Bands - Multi Timeframe [TradeMaster Lite].txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Copyright (c) 2023 trademasterindicator. All rights reserved.
// The Pinescript source code ("MACD Bands - Multi Timeframe [TradeMaster Lite]") is exclusively licensed to trademasterindicator TradingView account. No other use is permitted without written consent from trademasterindicator.
// By accessing or using the script, you agree to the following terms:
// Grant of License: You are granted a non-transferable license to use the script for personal, non-commercial purposes related to technical analysis and trading on TradingView.
// Ownership and Intellectual Property: trademasterindicator retains all ownership and intellectual property rights to the script. You may not modify, reverse engineer, or distribute the script.
// Disclaimer of Warranty: The source code is provided as-is, without warranties. trademasterindicator shall not be liable for any damages arising from its use.
// Termination: This license is valid until terminated.
//@version=5 
//https://www.youtube.com/watch?v=2z1edwCJ6VM
indicator("MACD Bands - Multi Timeframe [TradeMaster Lite]", 'MACD Bands - MTF [TradeMaster Lite]', precision = 3)


// INPUTS \\
i_src    = input.source   (close, 'Source'   , inline = 'src')
i_tf     = input.timeframe(''   , 'Timeframe', inline = 'src', tooltip = 'Only timeframes higher than the chart timeframe is supported currently. Might get updated in the future.')
i_maType = input.string   ('EMA', 'MA Type'  , inline = 'ma' , options = ['SMA','SMMA','EMA','DEMA','TEMA','LSMA','HMA','VWMA','WMA'], tooltip = 'Moving average calculation that is used across the script.\n\nThe choices available in our system include:\n● SMA (Simple Moving Average): This calculates the average of a selected range of prices, typically closing prices, by the number of periods in that range.\n● SMMA (Smoothed Moving Average): This takes into account all data available and assigns equal weighting to the prices.\n● EMA (Exponential Moving Average): This places a greater weight and significance on the most recent data points.\n● DEMA (Double Exponential Moving Average): This is a faster-moving average that uses a proprietary calculation to reduce the lag in data points.\n● TEMA (Triple Exponential Moving Average): This is even quicker than the DEMA, helping traders respond more quickly to changes in trend.\n● LSMA (Least Squares Moving Average): This moving average applies least squares regression method to determine the future direction of the trend.\n● HMA (Hull Moving Average): This moving average is designed to reduce lag and improve smoothness, providing quicker signals for short-term market movements. \n● VWMA (Volume Weighted Moving Average): This assigns more weight to candles with a high volume, reflecting the true average price more accurately in high volume periods.\n● WMA (Weighted Moving Average): This assigns more weight to the latest data, but not as much as the EMA.\n\nEach type of moving average offers a unique perspective and can be used in different scenarios to identify market trends.')
i_bbMult = input.float    (1    , 'Band mult', inline = 'ma' , minval = 0.1, maxval = 100, step = 0.1)
i_fast   = input.int      (12   , ''         , inline = 'len')
i_slow   = input.int      (26   , ''         , inline = 'len')
i_sign   = input.int      (9    , ''         , inline = 'len')


// OBJECT BLUEPRINT \\
type Macd
    float line = na
    float sign = na
    float hist = na
    float top  = na
    float bot  = na


// FUNCTIONS \\
get_sec(tf , exp) => request.security('', tf, exp[1], barmerge.gaps_off, barmerge.lookahead_on)
dema   (src, len) => ema = ta.ema(src, len), 2 * ema - ta.ema(ema,len)
tema   (src, len) => ema = ta.ema(src, len), ema2 = ta.ema(ema, len), 3 * (ema - ema2) + ta.ema(ema2, len)

get_ma(src, len) =>
    switch i_maType
        'SMA'  => ta.sma   (src, len)
        'SMMA' => ta.rma   (src, len)
        'EMA'  => ta.ema   (src, len)
        'DEMA' => dema     (src, len)
        'TEMA' => tema     (src, len)
        'LSMA' => ta.linreg(src, len, 0)
        'HMA'  => ta.hma   (src, len)
        'VWMA' => ta.vwma  (src, len)
        'WMA'  => ta.wma   (src, len)

get_macd() =>
    macd      = get_ma  (i_src, i_fast) - get_ma(i_src, i_slow)
    sign      = get_ma  (macd , i_sign)
    deviation = ta.stdev(sign , i_sign) * i_bbMult
    Macd.new(macd, sign, macd - sign, sign + deviation, sign - deviation)


// CALCULATION \\ exclued ltf for now, irrelevant and noisy anyways
var color clrHist = na
var isMtf = not na(i_tf) and timeframe.in_seconds(i_tf) > timeframe.in_seconds()
tf_change = isMtf ? timeframe.change(i_tf) : true
macd      = get_macd()
macd     := isMtf ? get_sec(i_tf, macd) : macd
clrHist  := macd.hist > macd.hist[1] ? #00897b83 : macd.hist < macd.hist[1] ? #ff990080 : clrHist


// PLOTS \\
isBull   =  macd.line > macd.sign
macdline = plot(tf_change ? macd.line : na, 'macdLine', isBull ? #4caf50 : #ff5252)
plot(tf_change ? macd.sign : na, 'signalLine', #ffeb3b)

plot(macd.hist, 'histogram ', clrHist, style = plot.style_columns)
plot(ta.cross(macd.line, macd.sign) ? macd.line : na, 'cross', isBull ? #00897b : #ff9800, 4, plot.style_circles)

bTop = plot(tf_change ? macd.top : na, 'band top', #2196f31a)
bBot = plot(tf_change ? macd.bot : na, 'band bot', #2196f31a)


// FILLS \\
fill(bTop    , bBot,                        #2196f31a     , 'Fill band', fillgaps = true)
fill(macdline, bTop, macd.line > macd.top ? #4caf4f7d : na, 'Fill bull', fillgaps = true)
fill(macdline, bBot, macd.line < macd.bot ? #ff525288 : na, 'Fill bear', fillgaps = true)

// a zero line :) \\
hline(0, '0 Line', linestyle = hline.style_dotted, color = color.gray, editable = false)

Overview

MACD Bands - Multi Timeframe [TradeMaster Lite] offers nine customizable moving average types, including SMA, EMA, DEMA, TEMA, Hull MA, Volume Weighted MA, and Least Squares MA. Users can adjust the fast, slow, and signal period settings, along with the band multiplier factor and target timeframe. It provides customizable momentum and trend analysis based on higher-timeframe price data.

Details

Published by

jash-git on GitHub

Code credit

trademasterindicator., as written in the script's header

Draws

Separate pane below the chart

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.

Settings

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

SettingTypeDefaultVariable
Sourcesourceclosei_src
Timeframetimeframei_tf
MA TypestringEMAi_maType
Band multfloat1i_bbMult
i_fastint12i_fast
i_slowint26i_slow
i_signint9i_sign
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

MACD-V

by harryguiacorn
220 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

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

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers