Help getting the color of a an indidator.

 

I am able to get the value of my indicator using:

double MyLevel=iCustom(NULL,0,"MyIndicator",0,0); // The current level

But i also need the color. I need to know if it is red or green. I have searched through this site and i haven't seen any code that will retreive the color of the indicator.

I did find this in the documentation.

color oldColor=ObjectGet("hline12", OBJPROP_COLOR);

But I couldn't figure out how to get my inidcator in there instead of hline12.

BTW, my idicator is in the main window.

Any help would be appreciated.

 

Why not use the same logic test that changes it's color in the main window in you indicator window ?

 

Because I've already done that and stored the value in the color. I con't want to roll through the history again and do the calculation each time I need to check the color.

 

indicator color

FlatLine:
I am able to get the value of my indicator using:

double MyLevel=iCustom(NULL,0,"MyIndicator",0,0); // The current level

But i also need the color. I need to know if it is red or green. I have searched through this site and i haven't seen any code that will retreive the color of the indicator.

I did find this in the documentation.

color oldColor=ObjectGet("hline12", OBJPROP_COLOR);

But I couldn't figure out how to get my inidcator in there instead of hline12.

BTW, my idicator is in the main window.

Any help would be appreciated.

Maybe this is to simple : old color = indicator_color

Forgive me if this is inapropirate (i am a newbie) but I recently used that to comment on the color of my indicator in the main window.

would be happy if this helps.

 
FlatLine:
Because I've already done that and stored the value in the color. I con't want to roll through the history again and do the calculation each time I need to check the color.

Hmmm, I recon you could be helped faster if you are more detailed about what EXACTLY it is you are trying to accomplish, it is difficult to lend a hand but first having to use trail-&-error to figure out what it is you want let alone how to fix it. So I am sure that if we receive more details, someone would be glad to help you out

 

I'm not sure you can do that for iCustom. Multi-color indicators usually have multiple buffers, one buffer for each color, so instead of looking for color value look for buffer value, i.e.:

buffer1 is green, buffer2 is red. Usually, they are not diplayed at he same time, say when there is an uptrend, green is displayed, when downtrend, red is displayed. That means, when green has a given value, red is 0 or -1 or novalue.

So, if buffer1 is positive and buffer2 is 0 (buffer1>0 && buffer2<=0), you know there is a green color displayed.

Reason: