This indicator draws three average lines. The green line is the average value of the last p swing high fractals and the red line is the average value of the last p swing low fractals. The blue line is the mid point between these two averages.
This indicator only works on PRTv11 onwards.
Set the period used for the average calculation by changing the value of p.
The type of fractal used in the calculation can be changed by adjusting the ‘BarsBefore’ and ‘Bars After’ settings. For example if BarsBefore = 2 and BarsAfter = 1 then the swing high fractals would have a high with two bars preceding it with lower highs and one bar after it with a lower high and the swing low fractals would have a low with two bars preceding it with higher lows and one bar after it with a higher low.
The displaying of the three lines can be turned on or off using the ‘HighFracAverage’, ‘LowFracAverage’ and ‘MidAverage’ settings.
As always I advise downloading and importing the ITF file to get full functionality.
p = 50
BarsBefore = 2
BarsAfter = 2
Support = 1
Resistance = 1
once supportavg = undefined
once resistanceavg = undefined
if barindex >= barsbefore + barsafter then
BarsBefore = max(BarsBefore,1)
BarsBefore = max(BarsAfter,1)
BarLookBack = BarsAfter + 1
if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THEN
if low[BarsAfter] = lowest[BarLookBack](low) THEN
a = a + 1
$supportvalue[a] = low[barsafter]
if support then
supporttotal = 0
if a >= p then
for c = a downto a-p+1
supporttotal = supporttotal+$supportvalue[c]
supportavg = supporttotal/p
if high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THEN
if high[BarsAfter] = highest[BarLookBack](high) THEN
b = b + 1
$resistancevalue[b] = high[barsafter]
if resistance then
resistancetotal = 0
if b >= p then
for c = b downto b-p+1
resistancetotal = resistancetotal+$resistancevalue[c]
resistanceavg = resistancetotal/p
midavg = ((supportavg + resistanceavg)/2)
if not highfracaverage then
resistanceavg = undefined
if not lowfracaverage then
supportavg = undefined
if not midaverage then
midavg = undefined
return supportavg coloured(128,0,0), resistanceavg coloured(0,128,0), midavg coloured(0,0,255)
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 :