You define the colors at the global level:
Examples:
#property indicator_color1 Aqua #property indicator_color2 Red #property indicator_color3 White etc.. And chart type in Init: int init() { SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);// "Bars" are called Histogram SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID); return(0); }
Hi DayTrader,
Thanks for your reply... I am still having a problem with achieving my required results:
If i am not mistaken, what you have described will affect the style of a specific *indicator* (?)
As i mentioned, i am already using 6 out of 7 avalable indicator buffers (2 x EMA's and 4 x EMA Envelopes)
I want to affect the color of the default *price* bars, rather than an indicator color/value; and also to default the chart to a "Bar Chart".
(BTW, these default values are to be set as constants, once set they stay that way)
I do not wish to assign the OCHL price values to another 4 buffers. (as 6/7 buffers are already in use)
I just want to effect the color of the actual default prices bars in the MQL code...
So that when the custom indicator is attached to a chart, it is set to type "Bars" and the "Down Bars" are colored in red.
I know this can easily be set in a profile or template, but i want the indicator to default to the chart to the required values.
I appreciate any further comments or advise.
Many Thanks.
So that when the custom indicator is attached to a chart, it is set to type "Bars" and the "Down Bars" are colored in red.
you have 8 buffers (lines/bars/etc) in each indicator window.
each can have its own color/drawingstyle.
if you want green for positive values and red for negative values, you have to use 2 buffers, one for red, one for green
read the manual for more information (SetIndexStyle)

- 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
I have created a custom indicator that already uses 6 of the available indicator buffers.
I want to set defaults for the following (from the indicator code):
Chart Type = Bars
bardown_color = Red
Please can someone advise me how to default the chart type to bars AND make the bardown_color set to Red by default from the mql code. ?
(The bardown_color is a variable found in the profile settings file, not my mql code)
For example in my custom indicator code, I am interating through the records within the loop:
for(int i=0; i<limit; i++)
{
// render my EMA's
// render labels and arrows
// Set downbar_color to red here ?
}
OR set the chart type = bars and downbar_color = Red as a constant at the top of the code ?
Many Thanks for any comments or advise.