// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © unnoticed_owl //@version=5 indicator("~Vol. Price", explicit_plot_zorder = true) //---- Inputs vol_fast_length = input( 7, "Fast Length") vol_slow_length = input( 14, "Slow Length") col_vpfast = color.rgb(71, 99, 224) col_vpslow = color.rgb(233, 78, 125) col_price_rising = color.rgb(177, 177, 177) col_price_falling = color.rgb(44, 44, 44) //---- Functions vol_price(v, p) => v * p //---- Calculations vol_fast = ta.ema(volume, vol_fast_length) price_fast = ta.ema(close, vol_fast_length) vp_fast = vol_price( vol_fast, price_fast ) ma_vp_fast = ta.sma( vp_fast, 3) vol_slow = ta.ema( volume, vol_slow_length ) price_slow = ta.ema( close, vol_slow_length) vp_slow = vol_price( vol_slow, price_slow ) ma_vp_slow = ta.sma(vp_slow, 3) vp_difference = vp_fast - vp_slow price_difference = price_fast - price_slow price_difference_max = ta.highest( price_difference, vol_slow_length) price_difference_min = ta.lowest( price_difference, vol_slow_length) price_difference_normalized = ( price_difference - price_difference_min ) / ( price_difference_max - price_difference_min ) col_price_difference = color.from_gradient( price_difference_normalized, 0, 1, col_price_falling, col_price_rising) //transparency_price_change = () //---- Plots plot(ma_vp_fast, color=col_vpfast, style = plot.style_line) plot(ma_vp_slow, color=col_vpslow, linewidth = 2) //plot( vp_difference, color=color.rgb(0, 102, 255)) bgcolor( col_price_difference )