How to get Custom Indicator Properties Color

 

Dear MT4 Guru

I have a for loop and I would like to create a Legend for the currency pair, that will having the same color of the line that set in the properties

So, my proposal is to retrieved from ObjectGet (...OBJPROP_COLOR) dynamically, and later use ObjectSet to set it to the legend text.

StrCurrencyPairList is a array that contains like EURUSD,CHFJPY,AUDNZD

StrCurrencyPairCount is the number of count in that array.

i.e

for(i = 0;i < StrCurrencyPairCount;i++){

SetIndexStyle( i, DRAW_LINE, STYLE_DOT, 1);
SetIndexEmptyValue( i, EMPTY_VALUE );
SetIndexLabel( i, StrCurrencyPairList[i]);
int j = i * 60 + 230; // this is to set the position of the legend

getColor = ObjectGet(StrCurrencyPairList[i], OBJPROP_COLOR);

ObjectCreate(StrCurrencyPairList[i], OBJ_LABEL, 0, 0, 0);
ObjectSet(StrCurrencyPairList[i], OBJPROP_XDISTANCE, j);
ObjectSet(StrCurrencyPairList[i], OBJPROP_YDISTANCE, 0);
ObjectSetText(StrCurrencyPairList[i], StrCurrencyPairList[i], 8, "Arial Black");
ObjectSet(StrCurrencyPairList[i], OBJPROP_COLOR, getColor);

}


ObjectSet(StrCurrencyPairList[i], OBJPROP_COLOR, getColor) doesn't give me the color that set in the Properties


If I hardcode the color, i.e ObjectSet(StrCurrencyPairList[i], OBJPROP_COLOR, Yellow), then I will see all Legend set in Yellow color

What is wrong here with getColor ? Appreciate your advice.


Regards,

Magix