declare lower; declare once_per_bar; input Hullperiod = 20; input SlopeAvgPeriod = 1; input centerline = 0.0; input showBreakoutSignals = no; def HullAvgslope = HullMovingAvg(close, Hullperiod); def slopeavg = Average(HullAvgslope, SlopeAvgPeriod); def height = slopeavg - slopeavg[SlopeAvgPeriod]; def slope = ATan(height / SlopeAvgPeriod) * 180 / Double.Pi; def condLong1 = (slope is greater than 0 and close is greater than ParabolicSAR()); rec counter = if condLong1 then counter[1] + 1 else 0; plot signalLong = if condLong1 then 1 else Double.NaN; signalLong.SetDefaultColor(Color.GreeN); signalLong.SetPaintingStrategy(PaintingStrategy.ARROW_UP); plot BarCounter = counter;