//Body and Range History Indicator
//By Vonasi
//09122018
//Biggest = 1 //1 = plot biggest
//Averages = 1 //1 = Plot Averages
//Multiples = 1 //1 = Plot Multiples
biggestrnge = max(biggestrnge,high-low)
biggestrdbody = max(biggestrdbody, open-close)
biggestgrnbody = max(biggestgrnbody, close-open)
if close > open then
up = up + (close - open)
upcount = upcount + 1
endif
if close < open then
down = down + (open - close)
downcount = downcount + 1
endif
upave = up/upcount
downave = down/downcount
upmult = biggestgrnbody/upave
downmult = biggestrdbody/downave
rnge = rnge + (high - low)
rngecount = rngecount + 1
rngeave = rnge/rngecount
rngemult = biggestrnge/rngeave
if biggest then
biggestrnge1 = biggestrnge
biggestrdbody1 = biggestrdbody
biggestgrnbody1 = biggestgrnbody
else
biggestrnge1 = 0
biggestrdbody1 = 0
biggestgrnbody1 = 0
endif
if averages then
upave1 = upave
downave1 = downave
rngeave1 = rngeave
else
upave1 = 0
downave1 = 0
rngeave1 = 0
endif
if multiples then
upmult1 = upmult
downmult1 = downmult
rngemult1 = rngemult
else
upmult1 = 0
downmult1 = 0
rngemult1 = 0
endif
return biggestrnge1 as "Biggest Range", biggestrdbody1 coloured(128,0,0) as "Biggest Red Body" , biggestgrnbody1 coloured(0,128,0) as "Biggest Green Body", upave1 coloured(0,128,0) as "Green Body Average", downave1 coloured(128,0,0) as "Red Body Average",upmult1 coloured(0,128,0) as "Biggest Green Body as Multiple of Average", downmult1 coloured(128,0,0) as "Biggest Red Body as Multiple of Average", rngeave1 coloured(0,0,0) as "Range Average", rngemult1 coloured(0,0,0) as "Biggest Range as Multiple of Average"