How to get color, or buffer used from a custom indicator ?

 

Dear All,

I need some help on the following issue.

I have a custom indicator, which display TREND in separate window. There are 3 color used to display TREND

1: Green => Which is show UP TREND

2: RED => Which is show DOWN TREND

3: Yellow => Which is happen between UP TREND and then DOWN TREND

So in summary, it will show the GREEN line then when indicator think that this is the end of the UP TREND, it will show the line in YELLOW, then when indicator think that now there is DOWN TREND, it will display line in RED. Same on the other way, when indicator think that DOWN TREND is over, it will display line in YELLOW then will do GREEN if UP TREND is starting.

What I am trying to do is, I want to get the current indicator line color.

So, from my EA, I am writing the 3 possible buffer used by this indicator to display the colored line.

This is the code:

    Comment("\n"
      + "Indicator: " + Indicator1 + "\n"
      + "-------------------------------------\n"
      + "Buffer0 = " + DoubleToStr(iCustom(NULL,0,Indicator1,0,0),Digits) + "\n"
      + "Buffer1 = " + DoubleToStr(iCustom(NULL,0,Indicator1,1,0),Digits) + "\n" 
      + "Buffer2 = " + DoubleToStr(iCustom(NULL,0,Indicator1,2,0),Digits) + "\n"
      + "-------------------------------------\n"
      );

When line displayed in RED, I see that Buffer0 and Buffer2 have a value.

When line displayed in GREEN, I see that Bufefr0 and Buffer1 have a value.

However, I have an issue to get the YELLOW.

If TREND started to go UP, then before displaying GREEN, it will display YELLOW. When that happen, the same buffers are used as for the GREEN

If TREND started to go DOWN, then before displaying RED, it will display YELLOW. When that happen, the same buffers are used as for the RED.

So how do I know, when Yellow is displayed?

Is anyone out there can help me with this?

Many thanks.


Regards,

Gabor

 

To change colour, then the bar at which colour changes has to have TWO buffer values set:

- the buffer for the PREVIOUS colour, and

- the buffer for the NEXT colour

So ... a colour change is indicated by the presence of 2 buffer values

The new colour is ... the colour for this bar that isn't used for previous bar

Reason: