Hi, a good day to everybody.
Can someone help me? I want to let the user modify the color in the Example indicator ZigZag, so I added this code to it:
but I have difficulties when I try to pass the variable as a property in the line
#property indicator_color1 zigzag_colors
that produce the error constant needed.
Is that possible? Thanks
Try this
No need to declare an enumeration. Use the color data-type.
Here is an example of multiple color inputs ...
input color clrBandingCenter = clrYellow, // Colour of Center Banding clrBandingDevaitions = clrGray, // Colour of Band Deviations clrBandingUpper = clrAqua, // Colour of Upper Banding clrBandingLower = clrMagenta, // Colour of Lower Banding clrBandingTrendUp = clrAqua, // Colour of Up Trend Symbol clrBandingTrendDown = clrMagenta, // Colour of Down Trend Symbol clrSignalBuy = clrAqua, // Colour of Buy Signal Symbol clrSignalSell = clrMagenta; // Colour of Sell Signal Symbol
- www.mql5.com
Many thanks Fernando, very interesting and I will use your example. But my problem is a complete different one. I need to pass the color name as a #property in the line
#property indicator_color1 custom_colorthat produces the error constant needed. Do you know the solution?
Do you mean like this?
#define MClrCandleUp C'38,166,154' #define MClrCandleDown C'239,83,80' #define MClrCandleNone C'239,166,117' #property indicator_color1 MClrCandleDown #property indicator_color2 MClrCandleUp #property indicator_color3 MClrCandleDown #property indicator_color4 MClrCandleUp #property indicator_color5 MClrCandleUp #property indicator_color6 MClrCandleNone
Please note, that the properties are set at compile time and that inputs are collected at run-time.
So you cannot assign an "input" to a "property". To set the colour of a plot, you need to use the PlotIndexSetInteger function ...
PlotIndexSetInteger( plot_index, PLOT_LINE_COLOR, clrDrawColour ); // Drawing Colour
- www.mql5.com
Do you mean like this?
Please note, that the properties are set at compile time and that inputs are collected at run-time.
So you cannot assign an "input" to a "property". To set the colour of a plot, you need to use the PlotIndexSetInteger function ...
As you said Fernando, I've added the line
PlotIndexSetInteger( 0, PLOT_LINE_COLOR, zigzag_color );
and deleted the #property one. Now I can assign a custom color.
Many thanks and sorry for the wrong section.
- 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, a good day to everybody.
Can someone help me? I want to let the user modify the color in the Example indicator ZigZag, so I added this code to it:
but I have difficulties when I try to pass the variable as a property in the line
#property indicator_color1 zigzag_colors
that produce the error constant needed.
Is that possible? Thanks