I have this code that creates long entries on either 24h volume increase or decrease by a percentage. Is there a way to adapt it so its for an absolute increase, e.g. when the volume increases by $1 million?
lower_tf = input('5', title='Lower Timeframe to Assess') // <=== Input Time Frame and Bars (288 bars for 24hrs in 5mins time frame)
bars_in_tf = input(288, title='Bars of lower Timeframe') - 1 // <=== -1 because we count from zero in the loop
//Calculating 24hrs Volume
buying_volume(range_1) =>
vol = float(na)
for i = 0 to range_1 by 1
if open[i] < close[i]
vol := na(vol) ? volume[i] : vol + volume[i]
vol
vol
lower_buy_vol = request.security(syminfo.tickerid, lower_tf, buying_volume(bars_in_tf))
volbuy = volume / lower_buy_vol // <=== Calculating percentage change with respect to 24hrs volume
longEntry = volbuy >= 0.03 // <=== Long Entry if Buy Volume increases by 3% or more - Change to whaterver value you want
shortEntry = volBuy <= -0.05 // <=== Long Entry if Buy Volume decreases by 5% or more - Change to whaterver value you want