How to find out the custom indicator color?

 
Hello,

I've got a question related to the color of a custom indicator. For finding the value it's pretty straight forward in calling
iCustom
for all the series. But what I'm interested in is to find out the exact color that particular indicator has at a point in time The reason is that asking for values may not be enough since the coloring logic is embedded inside the indicator and may be a result of quite complex decisions.

Not even sure this thing is possible... but do you have an idea on this?


Thanks
Galois
 

Generally, if the subwindow indicator uses standard indicator indexes, to get a different color, you must use
a different Index Number, 0 through 7

So, to determine the color using iCustom() you just need to know which Index in the indicator uses that color.

 
Well, that's what I thought for a while, but the attached indicator showed me I was wrong and the values were not enough for finding the color. Although the indicators I met this far could be applied this criteria...

LSMA_In_Color3 makes use of three colors: red, green and yellow in its painting process. Try to run it and you'll see if you can figure out what the color is by examining the data window only.

Red is when the
The yellow color only shows up when the underlying series of the indicator values are consequently swapping (wt[shift+1] < wt[shift]), but I only found out after taking the look at the internals of it... Added some printing messages and saw the message "... yellow..." was not being printed, while the color on the chart was obviously yellow. The coloring was occurring due to the indicator implementation, and not by the buffer values only...
Files:
 

Your indicator code seems broken, so:

//========== COLOR CODING ===========================================               
        
       ExtMapBuffer1[shift] = wt[shift]; //yellow
       ExtMapBuffer2[shift] = wt[shift]; //green
       ExtMapBuffer3[shift] = wt[shift]; //red 
       
 
        if (wt[shift+1] > wt[shift]) // red
        {
           ExtMapBuffer1[shift] = EMPTY_VALUE;
           ExtMapBuffer2[shift] = EMPTY_VALUE;
           Print("shift: " + shift + ", Color red");                
        }
        else if (wt[shift+1] < wt[shift]) // green
        {
            ExtMapBuffer1[shift] = EMPTY_VALUE; 
            ExtMapBuffer3[shift] = EMPTY_VALUE; 
            Print("shift: " + shift + ", Color green");        
        }
        else // yellow
        {
            ExtMapBuffer2[shift]=EMPTY_VALUE;
            ExtMapBuffer3[shift]=EMPTY_VALUE;
            Print("shift: " + shift + " Color yellow");
        }
      }
    
      return(0);
  }

Then:

if(ExtMapBuffer1[shift] != Empty_Value) FoundColor = Yellow;
if(ExtMapBuffer2[shift] != Empty_Value) FoundColor = Green;
if(ExtMapBuffer3[shift] != Empty_Value) FoundColor = Red;
 
Back again... added some output code in the for loop:

        if(shift < 20)
        {
            string msg = "";
            if(ExtMapBuffer1[shift] != EMPTY_VALUE)
            {
               msg = StringConcatenate(msg, " yellow");
            }
    
            if(ExtMapBuffer2[shift] != EMPTY_VALUE)
            {
               msg = StringConcatenate(msg, " green");
            }
 
            if(ExtMapBuffer3[shift] != EMPTY_VALUE)
            {
               msg = StringConcatenate(msg, " red");
            }
            Print("shift: " + shift + ":" + msg);
        }
From the output you cannot tell which color is on chart since the message will contain reference to more thane one color. Maybe it's this indicator that doesn't comply to the rule we all seem to guide upon:

one color = one buffer has values, the rest are empty
Reason: