How to define the color of a custom indicator as external parameter? To be user defined.

 

I wrote a custom indicator but it seems I cannot make the color user defined.

Any solutions?


Thank you.

 
thalassi:

I wrote a custom indicator but it seems I cannot make the color user defined.

Any solutions?


Thank you.


#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_width1 3
#property indicator_color2 Green
#property indicator_width2 3
#property indicator_color3 Yellow
#property indicator_width3 3
 

You are right. But this solution limits the choices to Red, Green and Yellow.

 
thalassi:

You are right. But this solution limits the choices to Red, Green and Yellow.



no it doesn't.  If you place the indicator a indicator like ichimoku you can change the colors also

//+------------------------------------------------------------------+
//|                                                     Ichimoku.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 SandyBrown
#property indicator_color4 Thistle
#property indicator_color5 Lime
#property indicator_color6 SandyBrown
#property indicator_color7 Thistle
//---- input parameters
extern int Tenkan=9;
extern int Kijun=26;
extern int Senkou=52;
//---- buffers
double Tenkan_Buffer[];
double Kijun_Buffer[];
double SpanA_Buffer[];
double SpanB_Buffer[];
double Chinkou_Buffer[];
double SpanA2_Buffer[];
double SpanB2_Buffer[];
//----
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()

color input 

 

You are absolutely right!

Is there a way perhaps to change the color thru the Inputs tab instead of the Colors?

I find it more user friendly thru Inputs.


Thank you again.

 
thalassi:

You are absolutely right!

Is there a way perhaps to change the color thru the Inputs tab instead of the Colors?

I find it more user friendly thru Inputs.


Thank you again.


I think this way is more user friendly

the user can also change width and style directly

The way you want it the user has still to go to inputs for changing the colors

So what difference does it make.... 

 Read this for your way and use extern input parameters 

 
Thanks but the SetIndexStyle link seems broken.
 
thalassi:
Thanks but the SetIndexStyle link seems broken.
Fixed . . .
 
Thanks. This is what I was looking for.
Reason: