# Scanner for 5 min green candles in a predetermined time period

#### Benjaminsabe

##### New member
Need some help with a scanner that primarly considers the morning, but I will watch the results in the afternoon.

I want to scan all the stocks that in the day, had the first 2 "5 minute" candles green. Also, that in that time period (9:30-9:40) it had a +5% change from the opening bell (not from the day before). Plus +2M in volume in that same time period

I already had a custom study that helped me scan percent gainers (+10%) after the opening bell. But like I said, I need to scan at the end of the day (that is when I´m free), for the +5% gainers during the first 10 min of the day.

So basically it would be three costums. One for the +5% gain from the opening bell till 9:40. The second one: two 5 min green candles from opening bell till 9:40. The third one, +2Mil in volume during that same time period (9:30 - 9:40)

Study I mentioned:
def desired_percent = 10;

def percent_from_open = round(100*((close/open)-1),1);

plot scan = percent_from_open >= desired_percent;

##### Well-known member
VIP
@Benjaminsabe How far have you gotten creating any of this...??? Making an effort should be considered somewhat of an expectation here... If all we do is hand out code then nobody will learn anything and that's not fair to those who took the time and put forth the effort to learn... Then it becomes a matter of being taken advantage of when you really think about it... We'll help you if you're willing to help yourself...

#### Benjaminsabe

##### New member
@Benjaminsabe How far have you gotten creating any of this...??? Making an effort should be considered somewhat of an expectation here... If all we do is hand out code then nobody will learn anything and that's not fair to those who took the time and put forth the effort to learn... Then it becomes a matter of being taken advantage of when you really think about it... We'll help you if you're willing to help yourself...
I found a way of doing the consecutive green candle stuff with the pattern --> Candles --> create, and made this

Code:
``````def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
IsUp[1] and
IsUp[0];

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
PatternPlot.SetDefaultColor(GetColor(0));``````

I saw the stocks that come up and it actually works. so I have that solved, and also the percent gainer from open, which is the code I posted before. The thing I really need, and I tried looking around here and couldn´t find, if there´s a way to add a time filter in my scanner, so it affects all the other conditions (volume, percent change,etc), and considers only the stocks that had them all, but during 9:30-9:40 only, without it mattering what happened later. I was thinking of having to add the time filter to each condition, but I guess it´s easier to add it as a condition by itself.

So in summary, is it possible to add a time filter in the scanner? And if so, how?
PD: sorry if my English is bad, I speak Spanish jajja