# 3 bear (or more) 3 bull(or more) 3 bear(or more)

1358

i need indicator or code to show alert when we have minimum 3 red candles  (can be more but at least 3), followed by minimum 3 green (can also be more but at least 3), followed by minimum three red again, if this criteria is met then we have alert :) any idea ? Thank you in advance
Moderator
5804

Dimitar Pavlov:
i need indicator or code to show alert when we have minimum 3 red candles  (can be more but at least 3), followed by minimum 3 green (can also be more but at least 3), followed by minimum three red again, if this criteria is met then we have alert :) any idea ? Thank you in advance

What causes the colors of these candles in the first place? Standard they are all green, or all green and white etc.

1358

red = bearish candles ,   green = bullish candles
Moderator
5804

Dimitar Pavlov:
red = bearish candles ,   green = bullish candles

There must be something that tells the candle to be green or red.

They do not show up green or red by themselves.

1358

this means red candle (bearish)

`if Open[1+i] > Close[1+i]    `

and this means green candle (bullish)

`if Open[1+i] < Close[1+i]    `
Moderator
5804

Dimitar Pavlov:

this means red candle (bearish)

and this means green candle (bullish)

That will not produce any colored candles.

Use 3 or more of those and you have your solution.

1358

where i did mention that i want colored candles ?! i dont want colored candles
Moderator
5804

Dimitar Pavlov:
where i did mention that i want colored candles ?! i dont want colored candles

You mentioned that you had colored candles so i asked you how did you get them.

This is important because you can use the same mechanism to extract the color from the candles.

For example you could write a simple code that looks out :

```//+------------------------------------------------------------------+
if(ObjectGetInteger(0,"Candle1",OBJPROP_COLOR,0)==clrGreen)
{
if(ObjectGetInteger(0,"Candle2",OBJPROP_COLOR,0)==clrGreen)
{
if(ObjectGetInteger(0,"Candle3",OBJPROP_COLOR,0)==clrGreen)
{
// 3 green candles in a row.
}
}
}
//+------------------------------------------------------------------+```

So i ask you what is coloring the candle?

Dimitar Pavlov:
red = bearish candles ,   green = bullish candles

This does not color candles

so i ask again what is coloring the candle ?

Dimitar Pavlov:

this means red candle (bearish)

```if Open[1+i] > Close[1+i]
```
`if Open[1+i] < Close[1+i]    `

and this means green candle (bullish)

But this also does not color a candle this determines the color but does not color the candle.

To color the candle.

`ObjectSetInteger(0,"Candle1",OBJPROP_COLOR,clrRed);`

This sets a color candle.

Then you proceed and tell me you do not want colored candles.

I also do not want colored candles i want to know how the candles are colored.

These are two different things.

But you can use a sequence of

`Open[X]>Close[X] && Open[Y]>Close[Y] && Open[Z]>Close[Z]`
1358

ok forget the red green (my mystake, sorry )  ,  i need  this: when we have minimum 3 bearish candles  (can be more but at least 3), followed by minimum 3 bullish (can also be more but at least 3), followed by minimum three bearish again, if this criteria is met then we have alert.
Moderator
5804

Dimitar Pavlov:
ok forget the red green (my mystake, sorry )  ,  i need  this: when we have minimum 3 bearish candles  (can be more but at least 3), followed by minimum 3 bullish (can also be more but at least 3), followed by minimum three bearish again, if this criteria is met then we have alert.
```//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
//---
if(Open[1]>Close[1])
{
if(Open[2]>Close[2])
{
if(Open[3]>Close[3])
{
if(Open[4]<Close[4])
{
if(Open[5]<Close[5])
{
if(Open[6]<Close[6])
{