Input Extension = 10; Input DaysGreen = 3; Input TimeLength = 9; Input TimeFrame = AggregationPeriod.Day; Def Price = Close(PriceType.Last); Def Runner; Def EMA = ExpAverage(close(period = TimeFrame), TimeLength); Def Extended = 100 * (price - EMA) >= EMA * Extension; Def GD2 = Price > close[1]; Def GD3 = Price > close[1] and close[1] > close[2]; Def GD4 = Price > close[1] and close[1] > close[2] and close[2] > close[3]; Def GD5 = Price > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] > close[4]; if DaysGreen == 2 and GD2 == 1 then { Runner = 1; } else if DaysGreen == 3 and GD3 == 1 then { Runner = 1; } else if DaysGreen == 4 and GD4 == 1 then { Runner = 1; } else if DaysGreen == 5 and GD5 == 1 then { Runner = 1; } else { Runner = 0; } plot scan = Extended == 1 and Runner == 1;