function Init() indicator:name("Bar Analysis Indicator"); indicator:description("Bar Analysis Indicator"); indicator:requiredSource(core.Bar); indicator:type(core.Indicator); indicator.parameters:addGroup("Calculation"); indicator.parameters:addInteger("ATR_Period", "ATR_Period", "", 20); indicator.parameters:addInteger("MVA_Period", "MVA_Period", "", 200); indicator.parameters:addDouble("RE", "Empty Bar - Spread/Volume Ratio", "Empty Bar - Spread/Volume Ratio", "1.7"); indicator.parameters:addDouble("RC", "Compressed Bar - Spread/Volume Ratio", "Compressed Bar - Spread/Volume Ratio", "0.5"); indicator.parameters:addDouble("RC1", "Average Compressed Bar - Spread/Volume Ratio", "Average Compressed Bar - Spread/Volume Ratio", "0.7"); indicator.parameters:addDouble("OS", "RSI Oversold Level", "RSI Oversold Level", "35"); indicator.parameters:addDouble("OB", "RSI OverBought Level", "RSI OverBought Level", "65"); indicator.parameters:addBoolean("ShowCompressed", "Show Compressed bar", "", true); indicator.parameters:addBoolean("ShowAvgCompressed", "Show Average Compressed bar", "", true); indicator.parameters:addBoolean("ShowEmpty", "Show Empty bar", "", true); indicator.parameters:addBoolean("ShowNDNS", "Show No Demand-No Supply bars", "", true); indicator.parameters:addColor("clrDefaultUp", "Default UP bar color", "Default UP bar color", core.COLOR_UPCANDLE); indicator.parameters:addColor("clrDefaultDn", "Default DN bar color", "Default DN bar color", core.COLOR_DOWNCANDLE); indicator.parameters:addColor("clrComp", "Compressed bar color", "Compressed bar color", core.rgb(0, 0, 0)); indicator.parameters:addColor("clrAvgComp", "Average Compressed bar color", "Average Compressed Bar color", core.rgb(176, 87, 57)); indicator.parameters:addColor("clrCompOSB", "Compressed Over sold/bought bar color", "Compressed Over sold/bought bar color", core.rgb(0, 255, 0)); indicator.parameters:addColor("clrNS", "No Supply color", "No Supply color", core.rgb(78, 194, 239)); indicator.parameters:addColor("clrND", "No Demand color", "No Demand color", core.rgb(255, 0, 255)); indicator.parameters:addColor("clrEmptyUp", "Empty UP bar color", "Empty UP bar color", core.rgb(192, 192, 192)); indicator.parameters:addColor("clrEmptyDn", "Empty DN bar color", "Empty DN bar color", core.rgb(192, 192, 192)); end local first; local source = nil; local open=nil; local close=nil; local high=nil; local low=nil; local ATR_Period; local MVA_Period; local ATR; local MVA; local MVAV; local RSI; local RE; local RC; local RC1; local OS; local OB; local sa1; local sa2; function Prepare(nameOnly) source = instance.source; Percent=instance.parameters.Percent; MaxPeriod=instance.parameters.MaxPeriod; ATR_Period=instance.parameters.ATR_Period; MVA_Period=instance.parameters.MVA_Period; RE=instance.parameters.RE; RC=instance.parameters.RC; RC1=instance.parameters.RC1; OS=instance.parameters.OS; OB=instance.parameters.OB; ATR = core.indicators:create("ATR", source, ATR_Period); MVA = core.indicators:create("MVA", ATR.DATA, MVA_Period); MVAV = core.indicators:create("MVA", source.volume, MVA_Period); RSI = core.indicators:create("RSI", source, 14); sa1 = core.indicators:create("EMA", source.close, 5); sa2 = core.indicators:create("EMA", source.close, 10); first = source:first()+2; math.max( MVA.DATA:first(), ATR.DATA:first()+2, RSI.DATA:first()); local name = profile:id() .. "(" .. source:name() .. ")"; instance:name(name); if (nameOnly) then return; end open = instance:addStream("open", core.Line, name, "open", core.rgb(0, 0, 0), first) high = instance:addStream("high", core.Line, name, "high", core.rgb(0, 0, 0), first) low = instance:addStream("low", core.Line, name, "low", core.rgb(0, 0, 0), first) close = instance:addStream("close", core.Line, name, "close", core.rgb(0, 0, 0), first) instance:createCandleGroup("ColorCandle", "", open, high, low, close); end function Update(period, mode) if (period>first) then ATR:update(mode); MVA:update(mode); MVAV:update(mode); RSI:update(mode); sa1:update(mode); sa2:update(mode); open[period]=source.open[period]; close[period]=source.close[period]; high[period]=source.high[period]; low[period]=source.low[period]; -- Compressed bar if instance.parameters.ShowCompressed==true and ( ( ((((source.high[period]-source.low[period])/ MVA.DATA[period]) /(source.volume[period] / MVAV.DATA[period])) <= RC ) and (source.volume[period] > MVAV.DATA[period] )) or ( (source.high[period-1] - source.low[period-1]) >= 3 * MVA.DATA[period] and (source.high[period] - source.low[period]) <= 0.5 * (source.high[period-1] - source.low[period-1]) and source.volume[period-1] > 2 * MVAV.DATA[period-1] and source.volume[period] > 1.5 * MVAV.DATA[period] and source.volume[period] > 0.65 * source.volume[period-1] ) ) and (RSI.DATA[period] > OB or RSI.DATA[period] < OS) then open:setColor(period, instance.parameters.clrCompOSB); elseif instance.parameters.ShowCompressed==true and ( ( ((((source.high[period]-source.low[period])/ MVA.DATA[period]) /(source.volume[period] / MVAV.DATA[period])) <= RC ) and (source.volume[period] > MVAV.DATA[period] )) or ( (source.high[period-1] - source.low[period-1]) >= 3 * MVA.DATA[period] and (source.high[period] - source.low[period]) <= 0.5 * (source.high[period-1] - source.low[period-1]) and source.volume[period-1] > 2 * MVAV.DATA[period-1] and source.volume[period] > 1.5 * MVAV.DATA[period] and source.volume[period] > 0.65 * source.volume[period-1] ) ) then open:setColor(period, instance.parameters.clrComp); elseif instance.parameters.ShowAvgCompressed==true and ( ( ((((source.high[period]-source.low[period])/ MVA.DATA[period]) /(source.volume[period] / MVAV.DATA[period])) <= RC1 ) and (source.volume[period] > MVAV.DATA[period] )) or ( (source.high[period-1] - source.low[period-1]) >= 3 * MVA.DATA[period] and (source.high[period] - source.low[period]) <= 0.5 * (source.high[period-1] - source.low[period-1]) and source.volume[period-1] > 2 * MVAV.DATA[period-1] and source.volume[period] > 1.5 * MVAV.DATA[period] ) ) then open:setColor(period, instance.parameters.clrAvgComp); -- No Demand elseif instance.parameters.ShowNDNS==true and ( source.high[period]>source.high[period-1] and source.low[period]>=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==source.high[period] and source.close[period]>source.close[period-1] and source.volume[period]source.high[period-1] and source.low[period]>=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==(((source.high[period]-source.low[period])*0.5)+source.low[period]) and source.close[period]>source.close[period-1] and source.volume[period]source.high[period-1] and source.low[period]>=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==source.low[period] and source.close[period]>source.close[period-1] and source.volume[period]source.high[period-2] and source.low[period-1]>=source.low[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.high[period-3] and source.low[period-2]>=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]source.high[period-3] and source.low[period-2]>=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.high[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]source.high[period-3] and source.low[period-2]>=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]source.high[period-3] and source.low[period-2]>=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]source.high[period-4] and source.low[period-3]>=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==source.high[period-3] and source.close[period-3]>source.close[period-4] and source.close[period-3]==source.close[period-2] and source.close[period-3]==source.close[period-1] and source.close[period-3]>source.close[period] and source.high[period-3]>=source.high[period-2] and source.high[period-3]>=source.high[period-1] and source.high[period-3]>=source.high[period] and source.volume[period-3]source.high[period-4] and source.low[period-3]>=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==((source.high[period-3]-source.low[period-3])*0.5)+source.low[period-3] and source.close[period-3]>source.close[period-4] and source.close[period-3]==source.close[period-2] and source.close[period-3]==source.close[period-1] and source.close[period-3]>source.close[period] and source.high[period-3]>=source.high[period-2] and source.high[period-3]>=source.high[period-1] and source.high[period-3]>=source.high[period] and source.volume[period-3]source.high[period-4] and source.low[period-3]>=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-3]-source.low[period-3]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==source.low[period-3] and source.close[period-3]>source.close[period-4] and source.close[period-3]==source.close[period-2] and source.close[period-3]==source.close[period-1] and source.close[period-3]>source.close[period] and source.high[period-3]>=source.high[period-2] and source.high[period-3]>=source.high[period-1] and source.high[period-3]>=source.high[period] and source.volume[period-3]=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==source.high[period] and source.close[period]>source.close[period-1] and source.volume[period]=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==((source.high[period]-source.low[period])*0.5)+source.low[period] and source.close[period]>source.close[period-1] and source.volume[period]=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==source.low[period] and source.close[period]>source.close[period-1] and source.volume[period]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.high[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==source.high[period-3] and source.close[period-3]>source.close[period-4] and source.close[period-3]==source.close[period-2] and source.close[period-3]==source.close[period-1] and source.close[period-3]>source.close[period] and source.high[period-3]>=source.high[period-2] and source.high[period-3]>=source.high[period-1] and source.high[period-3]>=source.high[period] and source.volume[period-3]=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==((source.high[period-3]-source.low[period-3])*0.5)+source.low[period-3] and source.close[period-3]>source.close[period-4] and source.close[period-3]==source.close[period-2] and source.close[period-3]==source.close[period-1] and source.close[period-3]>source.close[period] and source.high[period-3]>=source.high[period-2] and source.high[period-3]>=source.high[period-1] and source.high[period-3]>=source.high[period] and source.volume[period-3]=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==source.low[period-3] and source.close[period-3]>source.close[period-4] and source.close[period-3]==source.close[period-2] and source.close[period-3]==source.close[period-1] and source.close[period-3]>source.close[period] and source.high[period-3]>=source.high[period-2] and source.high[period-3]>=source.high[period-1] and source.high[period-3]>=source.high[period] and source.volume[period-3]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]=source.low[period-3] and (source.high[period-2]-source.low[period-2])==(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==source.high[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])==(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-2]<=source.high[period-3] and source.low[period-2]>=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]==source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]source.close[period-4] or source.high[period-2]<=source.high[period-3] and source.low[period-2]>=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==source.low[period-2] and source.close[period-2]==source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]source.close[period-4] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.close[period-3] or source.high[period-1]<=source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]==source.volume[period-2] and source.volume[period-1]<=source.volume[period-3] or source.high[period-1]>source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]==source.volume[period-2] and source.volume[period-1]<=source.volume[period-3] or source.high[period-1]>source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]==source.volume[period-2] and source.volume[period-1]<=source.volume[period-3] or source.high[period-1]>source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]==source.volume[period-2] and source.volume[period-1]<=source.volume[period-3] or source.high[period-1]>source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]source.high[period-2] and source.low[period-1]>=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]>source.close[period-2] and source.close[period-1]>source.close[period] and source.high[period-1]>=source.high[period] and source.volume[period-1]=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==source.low[period] and source.close[period]=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==((source.high[period]-source.low[period])*0.5)+source.low[period] and source.close[period]=source.low[period-1] and (source.high[period]-source.low[period])<(source.high[period-1]-source.low[period-1]) and source.close[period]==source.open[period] and source.close[period]==source.high[period] and source.close[period]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.high[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.low[period-2] and source.close[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.low[period-2] and source.close[period-2]>source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]>source.close[period] and source.high[period-2]>=source.high[period-1] and source.high[period-2]>=source.high[period] and source.volume[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]~=source.open[period-2] and source.close[period-2]==source.high[period-2] and source.close[period-2]=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==source.low[period-3] and source.close[period-3]=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==((source.high[period-3]-source.low[period-3])*0.5)+source.low[period-3] and source.close[period-3]=source.low[period-4] and (source.high[period-3]-source.low[period-3])<(source.high[period-4]-source.low[period-4]) and source.close[period-3]==source.open[period-3] and source.close[period-3]==source.high[period-3] and source.close[period-3]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]=source.low[period-3] and (source.high[period-2]-source.low[period-2])==(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==source.low[period-2] and source.close[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])==(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1] ~=source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])<(source.high[period-2]-source.low[period-2]) and source.close[period-1]~=source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==((source.high[period-2]-source.low[period-2])*0.5)+source.low[period-2] and source.close[period-2]==source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]=source.low[period-3] and (source.high[period-2]-source.low[period-2])<(source.high[period-3]-source.low[period-3]) and source.close[period-2]==source.open[period-2] and source.close[period-2]==source.high[period-2] and source.close[period-2]==source.close[period-3] and source.close[period-2]==source.close[period-1] and source.close[period-2]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==((source.high[period-1]-source.low[period-1])*0.5)+source.low[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]=source.low[period-2] and (source.high[period-1]-source.low[period-1])==(source.high[period-2]-source.low[period-2]) and source.close[period-1]==source.open[period-1] and source.close[period-1]==source.high[period-1] and source.close[period-1]==source.close[period-2] and source.close[period-1]= RE and (source.volume[period] < 1.2 * MVAV.DATA[period] ) and ((source.high[period]-source.low[period]) < 1.2 * ATR.DATA[period] ) ) then if source.close[period]>source.open[period] then open:setColor(period, instance.parameters.clrEmptyUp); else open:setColor(period, instance.parameters.clrEmptyDn); end else if source.close[period]>source.open[period] then open:setColor(period, instance.parameters.clrDefaultUp); else open:setColor(period, instance.parameters.clrDefaultDn); end end end end