I am getting the following error message for the code below. I have been stuck on this for days. Can anyone help trouble shoot?
Error at 28:16 Syntax error at input 'VPAIndx'
// © cnddavis
//@version=5
//Looking for anomalies between Volume and the Price Range/Body/Spread of the current bar.
indicator(title="Volume_Price_Analysis_Index", shorttitle = "VPA_Indx",precision=2, overlay=false)
// Would like this input below to be variable based on the Chart TF.
//Can we input the number of days and convert it to the number of bars needed based on the TF?
//I.E. 3 days = 234 bars on the 5' Chart; 78 bars on the 15' Chart; 39 bars on the 30' chart, etc.??
Bar_Count = input.int(title="How many bars to average:", defval=21)
// Compare current bar volume to average volume
AvgVolume = ta.sma(volume, Bar_Count)
VolumeIndx = (volume/AvgVolume)
// Compare current bar price (spread) range to average bar price range
CurrentSpread = math.abs(open-close)
AvgSpread = ta.sma(CurrentSpread, Bar_Count)
SpreadIndx = (CurrentSpread/AvgSpread)
// Compare current bar volume index to price range (spread) index
VPAIndx = VolumeIndx/SpreadIndx
// A value of 1 means that both the volume and price range are average.
// Less than 1 means that the volume is low for the price range so want to subtract 1 to make this a negative number.
// The difference between 1 and 0 are small compared to how large the greater than 1 results are so want to accentuate these negative numbers to see them better on the chart indicator.
if VPAIndx < 1 // <= This is line 28
VPAIndx := ((VolumeIndx/SpreadIndx)-1)*100
plotColor = (open<close) ? color.green : (open>close) ? color.red : color.silver
plot(VPAIndx, style=plot.style_histogram, linewidth=4,color=plotColor)