Ms

study(title="BestIntradayTips", shorttitle="BIT", precision=0, overlay=true, scale=scale.left)
trendDetectionLength=input(2)
showDistributionBelowZero=input(false, type=bool)
mov = close>close[1] ? 1 : close<close[1] ? -1 : 0
trend= (mov != 0) and (mov != mov[1]) ? mov : nz(trend[1])
isTrending = rising(close, trendDetectionLength) or falling(close, trendDetectionLength) //abs(close-close[1]) >= dif
wave=(trend != nz(wave[1])) and isTrending ? trend : nz(wave[1])
vol=wave==wave[1] ? (nz(vol[1])+volume) : volume
up=wave == 1 ? vol : 0
dn=showDistributionBelowZero ? (wave == 1 ? 0 : wave == -1 ? -vol : vol) : (wave == 1 ? 0 : vol)
input_src         = wave == 1 ? vol : 0
input_ma_period   = input(50, title="Moving average")
input_max_height  = input(1000, title="Maximum value on left bar")


ma                = sma(input_src, input_ma_period)
normalized_volume = min(input_src / ma * 100, input_max_height * 1)

plot(input_max_height, transp=100, title="")

//
input_src1         = showDistributionBelowZero ? (wave == 1 ? 0 : wave == -1 ? -vol : vol) : (wave == 1 ? 0 : vol)
input_ma_period1  = input(50, title="Moving average")
input_max_height1  = input(1000, title="Maximum value on left bar")
hline(0)
hline(250)
hline(500)
hline(750)
ma1                = sma(input_src1, input_ma_period1)
normalized_volume1 = min(input_src1 / ma1 * 100, input_max_height1 * 1)
resCustom = input(title="Timeframe", type=resolution, defval="1440" )
v=security(tickerid, resCustom,normalized_volume)
resCustom1 = input(title="Timeframe", type=resolution, defval="1440" )
v1=security(tickerid, resCustom,normalized_volume1)



a=v>0 and v1<50
b=v1>0 and v<50

bgcolor(a > 0 ? blue : na, transp=80)
bgcolor(b > 0 ? red : na, transp=80)

Disclaimer