Indicator · Pine Script v5 · Own pane

Dynamic Money Flow

by regalouisei· code credited to RezzaHmt

This indicator calculates volume-weighted money flow across price action, plotting in a separate pane.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code96
Settings17inputs
LicenceNone statedfile: MPL-2.0
Last update8 months ago25 Feb 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

96 lines of Pine Script v5 from pinescript/editors_picks/dynamic-money-flow.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

dynamic-money-flow.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RezzaHmt

//@version=5
import TradingView/ta/7

indicator('Dynamic Money Flow', 'DMF', precision = 2, timeframe = '')

mode                    = input.string('Index', 'Mode', options = ['Index', 'Cumulative'])
period                  = input.int(26, 'Period', minval = 1, tooltip = 'Only applies to index mode.')
ma_switch               = input.string('EMA', 'Moving Averages', options = ['OFF', 'EMA', 'WMA', 'T3', 'FRAMA'], tooltip = 'Set the type of Moving Averages added on DMF or turn them off. MAs can also be turned off individually by setting the length to zero.')
fast_len                = input.int(8, 'Fast Length', minval = 0)
slow_len                = input.int(20, 'Slow Length', minval = 0)
fastUp                  = input.color(#00FF8BFF, 'Fast Up Color')
slowUp                  = input.color(#28DF8BFF, 'Slow Up Color')
slowDn                  = input.color(#DF287CFF, 'Slow Down Color')
fastDn                  = input.color(#FF0074FF, 'Fast Down Color')
neutral                 = input.color(#CAA335FF, 'Neutral Color')
fMA_col                 = input.color(#00FF8B26, 'Fast MA Color')
sMA_col                 = input.color(#FF007426, 'Slow MA Color')
fill_transp             = input.int(70, 'Fill Transparency', minval = 0, maxval = 100)
simulative_vol          = input.bool(false, 'Simulative Volume', group = 'Experimental Options', tooltip = 'Use this option if volume is not provided for the security or it\'s inappropriate.')
vol_power               = input.float(1.0, 'Power', minval = 0, maxval = 5, group = 'Experimental Options', tooltip = 'The power to which volume is raised. Numbers below 1 reduce the significance of volume in calculations, while numbers above 1 add to it. Setting power to zero will exclude volume from calculations.')
weight_distribution     = input.string('Dynamic', 'Weight Distribution Method', options = ['Dynamic', 'Static'], group = 'Experimental Options', tooltip = 'This is from where Dynamic Money Flow derives its name. By default, weight distribution is dynamic. However, it can be changed to apply a static bias.')
static_dist_bias        = input.int(50, 'Static Weight Distribution Bias', minval = 0, maxval = 100, group = 'Experimental Options', tooltip = 'After setting the previous option to Static, you can set a bias factor (0 - 100) for weight distribution. When set to zero, only Close to Range comparison will take effect. And with 100, only Close to Close comparison will be applied.')

vol                     = switch simulative_vol
    true                => math.pow(math.abs(close - close[1]) + math.abs(high - math.max(open, close)) * 2 + math.abs(math.min(open, close) - low) * 2, vol_power)
    false               => math.pow(volume, vol_power)
    
alpha                   = switch weight_distribution
    'Dynamic'           => ta.tr == 0 ? 0 : math.abs((close - close[1]) / ta.tr)
    'Static'            => static_dist_bias / 100
    
trh                     = math.max(high, close[1])
trl                     = math.min(low, close[1])
ctr                     = ta.tr == 0 ? 0 : (close - trl + close - trh) / ta.tr * (1 - alpha) * vol
ctc                     = close - close[1] == 0 ? 0 : close > close[1] ? alpha * vol : -alpha * vol

dmf                     = switch mode
    'Index'             => ta.rma(ctr + ctc, period) / ta.rma(vol, period)
    'Cumulative'        => ta.cum(ctr + ctc)
    
fast_ma                 = if fast_len != 0
    switch ma_switch
        'EMA'           => ta.ema(dmf, fast_len)
        'WMA'           => ta.wma(dmf, fast_len)
        'T3'            => ta.t3(dmf, fast_len)
        'FRAMA'         => ta.frama(dmf, fast_len)

slow_ma                 = if slow_len != 0
    switch ma_switch
        'EMA'           => ta.ema(dmf, slow_len)
        'WMA'           => ta.wma(dmf, slow_len)
        'T3'            => ta.t3(dmf, slow_len)
        'FRAMA'         => ta.frama(dmf, slow_len)

// Color
var color main_color    = na

if      mode == 'Index'
    if      dmf >= 0 and dmf >= 0.1
        main_color := fastUp
    else if dmf >= 0 and dmf <  0.1
        main_color := slowUp
    else if dmf <  0 and dmf >= -0.1
        main_color := slowDn
    else
        main_color := fastDn
        
else if mode == 'Cumulative' and not na(fast_ma) 
    if      dmf >= fast_ma and fast_ma >= slow_ma
        main_color := fastUp
    else if dmf >= fast_ma and fast_ma <  slow_ma
        main_color := slowUp
    else if dmf <  fast_ma and fast_ma >= slow_ma
        main_color := slowDn
    else if dmf <  fast_ma and fast_ma <  slow_ma
        main_color := fastDn
else
    main_color := neutral

// Plots
pFastMA                 = plot(fast_ma, 'Fast MA', color = fMA_col, linewidth = 1)
pSlowMA                 = plot(slow_ma, 'Slow MA', color = sMA_col, linewidth = 1)
pMain                   = plot(dmf, 'DMF', color = main_color, linewidth = 2)
pZero                   = plot(mode == 'Index' ? 0 : na, editable = false, display = display.none)

hline(mode == 'Index' ? 0 : na, 'Zero Line', color = #787B86FF, linestyle = hline.style_dashed)
hline(mode == 'Index' ? 0.1 : na, 'Level', color = #787B8680, linestyle = hline.style_dashed)
hline(mode == 'Index' ? -0.1 : na, 'Level', color = #787B8680, linestyle = hline.style_dashed)

fill(pMain, pZero, title = 'Oscillator Background', color = color.new(dmf >= 0 ? fastUp : fastDn, 95))
fill(pFastMA, pSlowMA, title = 'Moving Average Fill', color = color.new(fast_ma > slow_ma ? fMA_col : sMA_col, fill_transp))

barcolor(main_color)

Overview

Dynamic Money Flow combines close-to-range and close-to-close metrics using dynamic or static weighting. Users can toggle between an index mode smoothed by RMA or a cumulative mode, apply simulative volume derived from candle ranges when real volume is unavailable, and overlay fast and slow moving averages (EMA, WMA, T3, or FRAMA) for trend confirmation.

Details

Published by

regalouisei on GitHub

Code credit

RezzaHmt, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Volume, Oscillators & momentum

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
ModestringIndexmode
Periodint26period
Moving AveragesstringEMAma_switch
Fast Lengthint8fast_len
Slow Lengthint20slow_len
Fast Up Colorcolor#00FF8BFFfastUp
Slow Up Colorcolor#28DF8BFFslowUp
Slow Down Colorcolor#DF287CFFslowDn
Fast Down Colorcolor#FF0074FFfastDn
Neutral Colorcolor#CAA335FFneutral
Fast MA Colorcolor#00FF8B26fMA_col
Slow MA Colorcolor#FF007426sMA_col
Show all 17 settings
SettingTypeDefaultVariable
Fill Transparencyint70fill_transp
Simulative Volumeboolfalsesimulative_vol
Powerfloat1.0vol_power
Weight Distribution MethodstringDynamicweight_distribution
Static Weight Distribution Biasint50static_dist_bias
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

Money Flow Index

by everget
948 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 10 days ago · GPL-3.0 GitHub repository of Money Flow Index

Commitment Gauge

by harryguiacorn
219 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

This indicator calculates the Bill Williams Market Facilitation Index as the high-low range divided by volume, or zero when volume is zero. It compares the index and volume with the previous bar and assigns one of four zones: green for both rising, fade for bo

Indicator v6 VolumeOscillators & momentum
Updated 4 weeks ago · Apache-2.0 GitHub repository of Bill Williams Market Facilitation Index

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

Chaikin Oscillator

by be-thomas
65 stars

Calculates the Chaikin Oscillator by taking the difference between a fast exponential moving average and a slow exponential moving average of the Accumulation/Distribution line. It plots the resulting line in a separate pane alongside a dashed zero reference l

Indicator v4 Oscillators & momentumVolume
Updated 4 days ago · GPL-3.0 GitHub repository of Chaikin Oscillator

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