When I developed the Distribution of Index indicator that can be found in the library I only had v11 end of day data and it has come to light that on live data it continuously updates the distribution chart tick by tick leading to an incorrect chart being displayed.
I have fixed the bug and suggest that anyone who uses v1.1 updates to v1.2.
ITF file attached.
//Distribution of Index v1.2
//PRT v11 onwards
//By Vonasi
//Date: 20210210
//p = 14 // Period used in indicator
//k = 3 // K% setting for stochastic
//d = 9 // Period used for signal line
//RSIndex = 1 // Select RSI
//Stoch = 0 // Select Stochastic
//WilliamsR = 0 // Select Williams%R
//ADXindex = 0 // Select ADX
//SignalLine = 1 // Turn on/off display of signal line
//StartDate = 19950101 // Date to start analysis from. Zero = all data
if date >= startdate then
if islastbarupdate then
$lastopen[0]=open
endif
p = max(1,p)
k = max(1,k)
d = max(1,d)
once signal = undefined
if RSIndex or (not Stoch and not WilliamsR and not ADXindex) then
indicator = rsi[p](close)
endif
if Stoch then
indicator = stochastic[p,k](close)
endif
if WilliamsR then
indicator = williams[p](close)+100
endif
if ADXindex then
indicator = ADX[p]
endif
if signalline then
signal = average[d](indicator)
endif
rindicator = round(indicator)
if open<>$lastopen[0] then
for a = 1 to 100
if rindicator = a then
$perc[a] = $perc[a]+1
maxval = max(maxval,$perc[a])
break
endif
next
endif
if islastbarupdate then
for a = 1 to 100
thisperc = round(($perc[a]/maxval)*100)
if rindicator = a then
drawpoint(barindex+thisperc+5,a,3) coloured(0,0,255)
drawtext("#thisperc#%",barindex+115,a,sansserif,bold,14) coloured(0,0,128)
endif
r = 255
g = 0
if thisperc >= 25 then
r = 128
g = 0
endif
if thisperc >= 50 then
r = 0
g = 255
endif
if thisperc >= 75 then
r = 0
g = 128
endif
drawrectangle(barindex+5,a,barindex+thisperc+5,a) coloured(r,g,128)
next
for a = 1 to 4
if ADXindex then
drawtext("ADX #p# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)
break
endif
if WilliamsR then
drawtext("Williams%R #p# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)
break
endif
if Stoch then
drawtext("Stochastic #p##k##d# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)
break
endif
if RSIndex or (not Stoch and not WilliamsR and not ADXindex) then
drawtext("RSI #p# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)
break
endif
next
endif
endif
return 0 coloured(0,0,0,0) as "Line",108 coloured(0,0,0,0) as "Line",indicator as "Indicator",signal style(dottedline) as "Signal"