# Original script by Cwparker23 # Mods/additions by Tidan # Updates: # Further reduced redundancy # # v2.1 #hint: The indicator finds irregular bodies based on candle size and volume it colors price to indicate irregular bodies below volume average (blue bullish and plum bearish) and indicate bodies above-average volume (cyan bullish and magenta bearish). Also colors price with above-average volume (green bullish and red bearish) and below-average volume (light green bullish and orange bearish). input multiplier = 2; input allowOpposingVolume = yes; AddLabel(yes, "Day_volume: " + volume (period = "DAY" ), Color.LIGHT_GRAY); AddLabel(yes, "volume: " + volume, Color.white); declare lower; declare zerobase; plot Vol = volume; plot VolAvg = expAverage(volume); VolAvg .SetPaintingStrategy(PaintingStrategy.squared_HISTOGRAM); VolAvg .SetDefaultColor(Color.GRAY); def BODY_RANGE = max(oPEN,cLOSE) - min(oPEN,cLOSE); def IR_BODY = if (BODY_RANGE < BODY_RANGE[1]) and (volume > volume[1]) then 1 else 0 ; def IR_BODYG = if IR_BODY and (close > open) then 1 else 0; def IR_BODYR = if IR_BODY and (close < open) then 1 else 0; #### def up3 = if IR_BODYG and (Vol > VolAvg) then 1 else 0; def up4 = if IR_BODYG then 1 else 0; def down3 = if IR_BODYR and (Vol > VolAvg) then 1 else 0; def down4 = if IR_BODYR then 1 else 0; def up = if (close > open) and (Vol > VolAvg) then 1 else 0; def down = if (close < open) and (Vol > VolAvg) then 1 else 0; def up2 = if (close > open) then 1 else 0; def down2 = if (close < open) then 1 else 0; #### Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); Vol.SetLineWeight(3); Vol.DefineColor("Up", Color.green); Vol.DefineColor("Down", Color.red); Vol.DefineColor("Up2", Color.light_green); Vol.DefineColor("Down2", Color.dark_ORANGE ); Vol.DefineColor("Up3", Color.cyan); Vol.DefineColor("Up4", Color.blue); Vol.DefineColor("Down3", Color.mAGENTA ); Vol.DefineColor("Down4", Color.plum ); Vol.AssignValueColor( if up3 then Vol.color("Up3") else if up4 then Vol.color("Up4") else if down3 then Vol.color("Down3") else if down4 then Vol.color("Down4") else if up then Vol.color("Up") else if down then Vol.color("Down") else if up2 then Vol.color("Up2") else if down2 then Vol.color("Down2") else GetColor(1)); input paintBars = yes; DefineGlobalColor("CAM_UP", Color.GREEN); DefineGlobalColor("CAM_UP2", Color.liGHT_GREEN); DefineGlobalColor("CAM_UP3", Color.cyan); DefineGlobalColor("CAM_UP4", Color.blue); DefineGlobalColor("CAM_DN", Color.RED); DefineGlobalColor("CAM_DN2", Color.darK_ORANGE ); DefineGlobalColor("CAM_DN3", Color.mAGENTA ); DefineGlobalColor("CAM_DN4", Color.plum ); AssignPriceColor( if !paintBars then Color.CURRENT else if up3 then GlobalColor("CAM_UP3") else if down3 then GlobalColor("CAM_DN3") else if up4 then GlobalColor("CAM_UP4") else if down4 then GlobalColor("CAM_DN4") else if up then GlobalColor("CAM_UP") else if down then GlobalColor("CAM_DN") else if up2 then GlobalColor("CAM_UP2") else if down2 then GlobalColor("CAM_DN2") else Color.CURRENT); def bull = if up3 and vol >= (volAvg * multiplier) and (up3[-1] or up4[-1] or up[-1] or up2[-1]) then yes else if allowOpposingVolume and down3 and (vol >= (volAvg * multiplier)) and (up3[-1] or up4[-1] or up[-1] or up2[-1]) then yes else double.nan; def bear = if down3 and vol >= (volAvg * multiplier) and (down3[-1] or down4[-1] or down[-1] or down2[-1]) then yes else if allowOpposingVolume and up3 and (vol >= (volAvg * multiplier)) and (down3[-1] or down4[-1] or down[-1] or down2[-1]) then yes else double.nan; addVerticalLine(bull[1],"bull",color.green,curve.short_dash); addverticalLine(bear[1],"bear",color.red,curve.short_dash); # end of script