Property Window / Indicator help

 

Is there anyway to lock the inputs tab on the property window in an indicator so the user can not change the settings?  Or define extern variables that users can not manipulate?

 

Delete the word "extern" from in front of all your variables(!)

Or do you want the user to see the inputs, but not be able to change them?

In which case, you'll need to have dummy externs (for display only) and have non-extern variables doing the work in your code.

 
honest_knave:

Delete the word "extern" from in front of all your variables(!)

Or do you want the user to see the inputs, but not be able to change them?

In which case, you'll need to have dummy externs (for display only) and have non-extern variables doing the work in your code.


If I delete extern in front of all the variables they are not computed the same.  They can not be changed while indicator is running and are not reinitialized.  When I do that MT4 freezes instantly
 

Also 

"Similar to input-variables, extern ones also determine the input parameters of an mql4 program. They are available from the Properties window. Unlike input variables, values of extern variables can be modified in the program during its operation. External variables are always reinitialized immediately before the OnInit() is called."

Extern variables behave differently than global or even input variables

Input Variables - Variables - Language Basics - MQL4 Reference
Input Variables - Variables - Language Basics - MQL4 Reference
  • docs.mql4.com
Input Variables - Variables - Language Basics - MQL4 Reference
 
PAPDoug:

If I delete extern in front of all the variables they are not computed the same.  They can not be changed while indicator is running and are not reinitialized.  When I do that MT4 freezes instantly


That is news to me.

With the extern removed, they will simply be global scope variables and most definitely can be assigned new values while the indicator is running. They will be re-initialized in an indicator.

 
Keith Watford:


That is news to me.

With the extern removed, they will simply be global scope variables and most definitely can be assigned new values while the indicator is running. They will be re-initialized in an indicator.


Like in the quote before though, extern variables can be modified during it's operation.  Global and Input variables have different properties otherwise there would be no point in defining them 3 different ways.  When I remove extern the indicator fails to draw.  Therefore , global variables and extern variables are not exactly the same in their capabilities.
 

Explicitly assign values to your non-extern variables in OnInit() if you are having issues.

The purpose of extern / input / sinput is to allow user-manipulation of the variable. If you are using them for any other reason, there are most likely issues elsewhere in your code. 

Reason: