You are on page 1of 1

#PivotBoss Advanced ADR

#Written by Frank Ochoa aka PivotBoss (http://pivotboss.com)


#Last Revised: October 22, 2014

#The Advanced ADR indicator allows you to calculate the average range in multiple
periodicities and for a user-defined number of periods. The default setting is
(1,10), which calculates the average range of a single bar over the last 10
periods. If you are in a Daily timeframe, this will give you the average daily
range over the last 10 sessions, while being in a 60-minute chart with this setting
would give you the average hourly range of the last 10 hours. To calculate a
rolling 5-day average range use (5,10) in a Daily timeframe, or use (3,10) to
calculate a rolling 3-day average. Use 1 Periods to analyze the current range, and
5 periods to analyze the current average range.

declare lower;

input Days = 1;
input Periods = 10;
input Expansion = 1.25;
input Compression = .65;
input AvgPeriods = 10;

def fRange = Highest(high, Days) - Lowest(low,Days);


def fAVGRange = Average(fRange,Periods);
def fAVGRange2 = Average(fRange,AvgPeriods);

plot Wide = (fAVGRange2 * Expansion);


plot Narrow = (fAVGRange2 * Compression);
plot AvgRange= fAVGRange2;
plot AdvancedADR = fAVGRange;
AdvancedADR.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
AdvancedADR.setDefaultColor(GetColor(3));
AdvancedADR.AssignValueColor(
if AdvancedADR <= Narrow then Color.MAGENTA
else if AdvancedADR >= Wide then Color.BLUE
else Color.LIGHT_GRAY);
Wide.setDefaultColor(GetColor(5));
Narrow.setDefaultColor(GetColor(5));
Wide.SetStyle(Curve.POINTS);
Narrow.SetStyle(Curve.POINTS);

You might also like