OBJ_HLINE Style/Color Set by USER

 

hi guys,

got dilemma with Line, seems fail to fix it  
i appreciate any insight on this

i can change color of line if i put it on extern section but its not very good way to change it i like to change as common style set em i mean this

H_Line Styles

but i don't know how when user for exam chose a color or different pattern grab and change the line with this new settings

 

i appreciate any insight on this guys thank you in advance 

 

This window is available due to this part of an indicator:

#property  indicator_buffers 2
#property indicator_color1  clrSkyBlue
#property indicator_color2  clrMagenta
 
Unfortunately, there is no "programmatic" way (at least in pure MQL) to know what the user has selected or changed in the default "Colors" panel of an Indicator.
 
gooly:

This window is available due to this part of an indicator:


yup thats how i show it on, however when i change color or style it doesn't applies to my line!
 
FMIC:
Unfortunately, there is no "programmatic" way (at least in pure MQL) to know what the user has selected or changed in the default "Colors" panel of an Indicator.

seriously? o.O so why they even put it there lol

 i was really looking to make my indicator bit better this way i guess back to normal extern settings -_- 

 
amin:

seriously? o.O so why they even put it there lol

 i was really looking to make my indicator bit better this way i guess back to normal extern settings -_- 

Seriously??? They put it there, so that the users can change the visual appearance of the indicator, obviously! However, you cannot "programmatically" know if the user chose Orange or Blue, or Thick or Thin, or Solid or Dotted, etc.

You can however, set "extern" or "input" parameters for them and have the user change them from the input parameters, and in this way you will "know" what the user choice is.

 
Don't use the properties
#property  indicator_buffers 2
#property indicator_color1  clrSkyBlue
#property indicator_color2  clrMagenta
Use inputs
#property  indicator_buffers 2
input color indicator_color1 = clrSkyBlue;
input color indicator_color2 = clrMagenta;
int Oninit(){
   SetIndexStyle(0, DRAW_LINE, EMPTY, EMPTY , indicator_color1);
   SetIndexStyle(1, DRAW_LINE, EMPTY, EMPTY , indicator_color2);
 
WHRoeder:
Don't use the properties
Use inputs

Thank you, i added your code however seems it missing something it draw nothing, i thought its black line or something but there was no line in mt4 object list wondering whats going on
 
amin:
Thank you, i added your code however seems it missing something it draw nothing, i thought its black line or something but there was no line in mt4 object list wondering whats going on

WHRoeder only gave you sample code for you to build on. It is up to you to implement and use all of the properties that you wish to use, such as Shape StyleDrawing Style, Line Width, Colour, Arrows, etc.

Read the documentation on all the various functions for a Custom Indicator: https://docs.mql4.com/customind

Reason: