Really: clrNone == 255,255,255 ?

 

Section 1: (input data for script, indicator, EA)

input color clr=clrNONE;  // or extern color clr=clrNONE; declaration by user

OnStart()       // or OnInit()

Alert(clr);     // return 255,255,255


or


Section 2:

OnStart()

{

  color clr=clrNONE;  // declaraion inside

  Alert(clr);  // return clrNONE

}

My questions:

1) Why?

2) How check if user set on input color clrNONE?

   Ad Section 1) condition as: if (clr==clrNONE) is unsatisfiable. 255,255,255 (white) is always different clrNONE (value -1 by documentation MQL)

 

use 

#property strict

and you will see. 

 

Here is actual test code:

Set clr_input in input dialog as clrNONE .... return clr_input=255,255,255

#property strict
#property script_show_inputs 

input color clr_input=clrRed;  // try set: clrNONE but in user´s input dialog! No in code mql4.
//+-------------------------------------+   -----+---------------------------
//| Script program start function       |        |
//+-------------------------------------+        |
void OnStart()                     //           \|/
{                                  //            V 
  Alert("clr_input=",clr_input);   // output: clr_input=255,255,255
  color clr=clrNONE;
  Alert("clr=",clr);               // output: clr=clrNONE
}
 
Intrusting. But it works ok.
 
endy5: 2) How check if user set on input color clrNONE?
Why do you care what color the user has set a line to? Just draw the line.
 
eevviill:
Intrusting. But it works ok.

Set on clrNONE in user input dialog

Message from terminal...

very interesting row: inputs: clr_input=....

 
WHRoeder:
endy5: 2) How check if user set on input color clrNONE?
Why do you care what color the user has set a line to? Just draw the line.

if (<user_input_set_clrNONE>) SetColorScheme_Auto()  else SetColorScheme_User();

By MT4: clrNONE is the same as 255,255,255 but in documentation is clrNONE have value "-1" ... Have I error somewhere?

Reason: