To change color of an indicator on the fly, you can use the SetIndexStyle() function again.
But, you want a line that alternates colors. For that you have to use two different
indicator indexes
that trace the same line, but show one (maybe red) when the value is below your
threshold, and
showing the other (green) when the value is above.
How would I go about making a second index within the indicator if I'm using 6 buffers already? Isn't the maximum 8?
thanks for the quick reply
"How would I go about making a second index within the indicator if I'm using 6 buffers already? Isn't the maximum 8?"
Yes, you are limited to 8.
Actually, only 5 are used right now:
SetIndexBuffer(0, RSI);
SetIndexBuffer(1, L0);
SetIndexBuffer(2, L1);
SetIndexBuffer(3, L2);
SetIndexBuffer(4, L3);
Buffer 5 is never "set", so this line does nothing
SetIndexDrawBegin(5, 1);
So, you can add another index for the second color you want to display,
I might rename RSI to be RSI_GREEN and the new one RSI_RED
--------
See Awesome.mq4 for an example, it comes with MT4
i like to see folks find their way with a clue or two...
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
What I'm looking to do is using the common Laguerre indicator, invert any values under 0.45 and turning those inverted values Red.
I inverted them fine, but I'm having an issue with making the color red. Help would be much appreciated.
As mentioned, I'm new to this language.... can I not just set new variable values if the expression changes? Perhaps there's a function for this that I missed... ..
Thanks.