How to specify the color of an indicator used in expert adviser?
How to specify the color of an indicator used in expert adviser?
Loading saved threads...
Degger · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Degger
Original post: https://stackoverflow.com/questions/79817466
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
My Expert Advisor uses two Moving Averages (MAs). I want them to be displayed on the chart with two distinct colors, like in this example:
However, my EA draws both of them with the default color (Red):
Here my aproach of initialisation:
int OnInit() {
hndlEMA_high = iMA(_Symbol, inp_tf, MA_Period_high, 0, MODE_EMA, PRICE_СLOSE);
PlotIndexSetInteger(hndlEMA_high, PLOT_LINE_COLOR, 0, C'252,191,77');
ChartIndicatorAdd(0, 0, hndlEMA_high);
hndlEMA_low = iMA(_Symbol, inp_tf, MA_Period_low, 0, MODE_EMA, PRICE_СLOSE);
PlotIndexSetInteger(hndlEMA_low, PLOT_LINE_COLOR, 0, C'103,108,255');
ChartIndicatorAdd(0, 0, hndlEMA_low);
if (hndlEMA_high == INVALID_HANDLE || hndlEMA_low == INVALID_HANDLE)
{
Print("Error creating EMA indicators");
return INIT_FAILED;
}
return(INIT_SUCCEEDED);
}
Quote
Report
Post Reply
Checking account access…