//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"
I wrote the above indicator to show what the biggest ever range, red body and green body size has been. It also calculates all time averages and what the biggest range and body sizes are as multiples of the average.
Here is the ITF file:
[attachment file=”Body and Range History.itf”]
I post it here just in case it is of interest to anyone. It is interesting to see how the average range and body size on the SP500 weekly for example has dramatically increased since computer trading started to be a thing in the mid 90’s. Also if we know what the extremes have been and what the averages are then we have a little bit more knowledge of what might happen in the future. It is interesting to note that one week ago the SP500 weekly had a biggest ever green body sized candle. Usually in the past big greens have been accompanied by big reds but maybe now due to all the tools put in place to prevent market crashes we won’t see one. There hasn’t been a bigger red bodied candle since the 2008 crash which was when a lot of the crash prevention anti shorting tools were put into place.
[attachment file=86623]
[attachment file=86624]
Hello @Vanosi, great Work.
Could you help me or other guys here in the community to programme a code. Need to open a new Topic ?
Best regards, Giuseppe
pippo999 – It is best to start a new topic with a new idea. There are several helpful coders (many much better than me!) who I’m sure will be able to help turn your idea into a strategy or even maybe tell you why your idea is not such a good idea from their experience.