Cond=xBody>=(xRange*0.20)//Body is 20%+ of the range
Result=summation[5](Cond)
RETURNResultAS"Result"
you asked for “body is 20%”, but his would almost never return a true value, since being exactly 20% is so rare, if not impossible! So I added >= so that any candle that is equal to or exceeds 20% returns true. Should you want to be returned when the body is <= 20% just replace “>” with “<“.
The returned values are 0 to 5 (0=none, 1…5=the number of candles that match your criterion). With the indicator properties you may select either a line or a histogram.