How to get custom indicator current color

 

Hi 

I hav an indicator which shows trend .

UpTrend is green and down trend is red.

As I know some of this kind of indicators are drawing 2 lines .one of them green and the other one red .

and when they want to show green one they make red one equal to zero and And conversely if they want red one so green one should be zero.


but this particular indicator is not like this and it seems both colors are belonging to the same line and whenever trend is getting change the color will change .

and also it is Not just a simple line , it is something related with heiken ashi . I mean it is not a line , its something like band or tape (my english not good enough).


All I need is having uptrend or down trend of this indicator in my Ea codes.



here are values it returns


 
Reza nasimi:

As I know some of this kind of indicators are drawing 2 lines .one of them green and the other one red .

When indicators use color histograms (DRAW_COLOR_HISTOGRAM) or color arrows (DRAW_COLOR_ARROW), the color is stored in a separate buffer, which you can access from your EA.

It's not obvious to me from your pictures what is being used. As you say, it may be related to heiken ashi. Even DRAW_COLOR_CANDLES has a separate color buffer.

So, you just need to determine the number of the color buffer and use CopyBuffer() to access it.

 
Anthony Garot:

When indicators use color histograms (DRAW_COLOR_HISTOGRAM) or color arrows (DRAW_COLOR_ARROW), the color is stored in a separate buffer, which you can access from your EA.

It's not obvious to me from your pictures what is being used. As you say, it may be related to heiken ashi. Even DRAW_COLOR_CANDLES has a separate color buffer.

So, you just need to determine the number of the color buffer and use CopyBuffer() to access it.

Hi Anthony Garot

First of all thank you for your help;

I didn't work much with indicators ,

how can I determine the number of the color buffer ?

I just know there is 2 colors.

 
Reza nasimi:

Hi Anthony Garot

First of all thank you for your help;

I didn't work much with indicators ,

how can I determine the number of the color buffer ?

I just know there is 2 colors.

You have three options, in decreasing order of efficacy:

1. Look inside the code of the indicator.

2. If you don't have the code of the indicator, ask the author the buffer numbers.

3. If you cannot get the buffer numbers of the author, use trial and error.

 
Anthony Garot:

You have three options, in decreasing order of efficacy:

1. Look inside the code of the indicator.

2. If you don't have the code of the indicator, ask the author the buffer numbers.

3. If you cannot get the buffer numbers of the author, use trial and error.


Thank you very much Anthony Garot

Reason: