LTF -> HTF volume delta Up/Down
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © fikira
//@version=5
indicator("LTF -> HTF volume delta Up/Down", overlay=false, format=format.volume)

// This script is part of a collection of educational scripts
// If you want to return to the open source INDEX page, click the link in the comments:
// -> https://www.tradingview.com/script/TUeC9XDq-Education-INDEX/

ltf = str.tostring(timeframe.isintraday ?  math.max(1, math.round(timeframe.multiplier / 50)) : timeframe.multiplier * 25 )

[nV, sV, bV, tV] = request.security_lower_tf(syminfo.tickerid, ltf, [close == open ? volume : 0, close < open ? volume : 0, close > open ? volume : 0, volume])
plot(volume, style=plot.style_columns, color=close > open ? color.new(color.lime , 85) : color.new(#FF0000 , 85), title='Total Volume', linewidth=2)

plot(array.sum(bV), color=color.lime, title='UP Volume LTF')
plot(array.sum(sV), color=color.red , title='DN Volume LTF')