# Bar color in Awesome Oscillator?

114484

I am new to the community ... my first post here.
Hope this is not a real stupid question:
I saw a post for this same question ... but no answer.

Does anyone have a method for returning the current color of the Awesome Oscillator within Meta-Trader?
MT4 has a function for returning the numeric value using iAO , but not the color.
Hopefully such a function would allow a test of (i) time frames backwards also.
114484

Try this:

```double val1= iAO(NULL,0, i);
double val2= iAO(NULL,0, i+1);

if (val1>val2) { // green

}
else {   // red

}
```

Cheers

Markus

114484

Try this:

```double val1= iAO(NULL,0, i);
double val2= iAO(NULL,0, i+1);

if (val1>val2) { // green

}
else {   // red

}
```

Cheers

Markus

Thanks Markus ... I am half way there now, thanks to you. Here is the trick part of the question:
1 - If there was a bar formation of red-red-red each one would be less than the one before it
2 - If the formation was green-red-red they would all be less than each other also (same as #1)

How could I determine when that a color change has occoured?

... thank you so much for the fast answer last time.

Peter in Minnesota
114484

Try this:

```double val1= iAO(NULL,0, i);
double val2= iAO(NULL,0, i+1);

if (val1>val2) { // green

}
else {   // red

}

// The only way you can see tick formation is by printing to Expert tab on Terminal screen.
// The Volume is your tick number.

if (val1>val2) { Print(Volume[i]," green");

}
else {Print(Volume[i]," red");

}

```

114484

```double val1= iAO(NULL,0, i);
double val2= iAO(NULL,0, i+1);
double val3= iAO(NULL,0, i+2);

if (val2<val3 && val1>val2 ) { // color switch red -> green

}
else
if (val2>val3 && val1<val2 ) { // green -> red

}
```

:-D

Markus

114484

```double val1= iAO(NULL,0, i);
double val2= iAO(NULL,0, i+1);
double val3= iAO(NULL,0, i+2);

if (val2<val3 && val1>val2 ) { // color switch red -> green

}
else
if (val2>val3 && val1<val2 ) { // green -> red

}
```

:-D

Markus

Briliant is so often simple ... thanks Markus!

Peter in Minnesota
114484

Glad to have been of help.

Markus