Indicators indexes are not Objects.
see SetIndexStyle()
--
As for your problem, you have not shown enough code to make a better reply.
double ma_1; ma_1=iMA(0,0,MA_Period,0,MA_Method,AppliedPrice,0); ObjectDelete("MA"+MA_Period); ObjectCreate("MA"+MA_Period ,OBJ_TEXT, 0, Time[0], ma_1+ 0.0020); ObjectSetText("MA"+MA_Period,short_name+ MA_Period+") ",12, "Arial", indicator_color1); return(0);
in a MA code,
the MA color is red, becasue
#property indicator_color1 Red
If i change it to black when adding the MA to my chart, the ObjectText doesnt read it black.
It reads indicator_color1 as per the originally given (red).
how to read the updated MA color ?
Thanks phy.
Use ObjectSet(name, OBJPROP_COLOR, yourColor);
Put this on a 1 minute chart to play with:
#property indicator_chart_window #property indicator_color1 DodgerBlue static double lastTick; int init() { lastTick = Close[0]; return(0); } int start() { int counted_bars=IndicatorCounted(); string name = "test_text"; ObjectDelete(name); ObjectCreate(name, OBJ_TEXT, 0, Time[0], High[0]+5*Point); ObjectSetText(name, DoubleToStr(Close[0], Digits)); if(Close[0] > lastTick) ObjectSet(name, OBJPROP_COLOR, Lime); else if(Close[0] < lastTick) ObjectSet(name, OBJPROP_COLOR, Red); //else ObjectSet(name, OBJPROP_COLOR, Yellow); else ObjectSet(name, OBJPROP_COLOR, indicator_color1); lastTick = Close[0]; return(0); }
I tried setting an object to the color of one of the buffers, like this:
ObjectSet(name, OBJPROP_COLOR, indicator_color1);
and it did not work.
Any ideas?
Larene
I tried setting an object to the color of one of the buffers, like this:
ObjectSet(name, OBJPROP_COLOR, indicator_color1);
and it did not work.
Any ideas?
Larene
ObjectSet(name, OBJPROP_COLOR, color);
I was trying to grab the color from the parameters. I wanted my objects to match the colors the user chose for the indicators.
Larene
extern color XXX = Red; //let the user to choose the color ObjectSet(name, OBJPROP_COLOR, XXX); // & set the color to the user choice

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi all,
i'm tring to call the "new" color i have given to the indicator in the ObjectSetText funtion, however, the "new" color is still "Red",
What should i be using to call the latest color assigned to the indicator & apply it to the text.
#property indicator_color1 Red
.
.
.
ObjectSetText ( bla bla bla, indicator_color1)
Thanks.