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

Do you have questions on how to turn your idea into reality? Ask them on the Forum!
1095
2016.08.09 10:13
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
4172
2016.08.09 11:19
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.

1095
2016.08.09 13:42
red = bearish candles ,   green = bullish candles
Moderator
4172
2016.08.09 14:04
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.

1095
2016.08.09 14:12

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
4172
2016.08.09 14:16
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.

1095
2016.08.09 14:20
where i did mention that i want colored candles ?! i dont want colored candles
Moderator
4172
2016.08.09 14:33
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]`
1095
2016.08.09 14:39
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
4172
2016.08.09 14:48
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])
{
}
}
}
}
}
}
}
//+------------------------------------------------------------------+```
It needs some tweaking but its not rocket science.
1095
2016.08.09 14:58
i already tried that  , and is not what i need  :/  i need something to count candles maybe. For example  we have 3 bearish (can be more but at least 3) then we have 3 bullish (can be more but at least 3) and finally we have to have 3 bearish , and we have alert.I hope you got what i mean :)
/ /12