This indicator gives an indication of recent market volatility based on the number of peaks and troughs in the p look back period.
A trough or a peak can be classified by the number of bars before and after a high or low that have lower highs (for a peak) or higher lows (for a trough). Change the ‘BarsBefore’ and ‘BarsAfter’ variables to select what type of peaks and troughs you are testing for. Some people call these fractals and others pivot points and others support and resistance but I am choosing to call them peaks and troughs!
The number of peaks and troughs in the look back period are counted and returned as a weighted average line chart centred around zero. The zero line represents the all time average of peaks and troughs for the period p.
Change the look back period length by changing the value ‘p’.
The green line represents peaks (P volatility) in the look back period and the red line represents troughs (T volatility) in the look back period. The blue line is peaks and troughs (P and T volatility) combined.
Low values show that there has not been a lot of peaks or troughs recently indicating a not very volatile market.
High values show that there has been a lot of peaks or troughs recently indicating a very volatile market.
Low and High volatility readings can sometimes indicate a market that is about to change or choose a direction.
If a market has been trending then we might see the P and T volatility dropping off as the market makes less and less peaks and troughs as it heads off in whichever direction it has chosen.
If the P value is high and the T value low then it might be that the market has recently been hitting upward resistance but little downward support.
How you finally analyse the indicators output is up to you!
I advise downloading and importing the ITF file to get full functionality.
//Peak andd Trough Volatility Indicator
//p = 50
//BarsAfter = 1
//BarsBefore = 1
BarLookBack = BarsAfter + 1
if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] then
if low[BarsAfter] = lowest[BarLookBack](low) then
sup=sup + 1
if high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] then
if high[BarsAfter] = highest[BarLookBack](high) then
res=res + 1
rsup = (sup - sup[p-1])*2
rres = (res - res[p-1])*2
tot = (rsup + rres)/2
ata = ((res + sup)/barindex)*p
tt = weightedaverage[p](rsup)
pp = weightedaverage[p](rres)
pt = weightedaverage[p](tot)
ttperc = ((tt/ata)*100)-100
ppperc = ((pp/ata)*100)-100
ptperc = ((pt/ata)*100)-100
return ttperc coloured(128,0,0) as "T Volatity", ppperc coloured(0,128,0) as "P Volatility", ptperc coloured(0,0,255) as "P and T Volatility",0
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.ProRealTime ITF files and other attachments :