Nothing has changed so there is probably an issue in your code.
Trying posting the section of code where you declare them
Nothing has changed so there is probably an issue in your code.
Trying posting the section of code where you declare them
Look at the test images. The simplest of simple
//+------------------------------------------------------------------+ //| example.mq5 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ extern int abc=123; input int def=234; //I want to see 2 parameters when attaching the indicator //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
Look attached
You know what, I didn't read your post properly. I thought you meant neither extern nor input were working.
I just tried it on build 1570 and you are quite right - no extern.
MQL4 is still happy with them though.
I'm not aware of any published change... but I may have missed it.
One of the other guys more clued up on MQL5 may be able to assist
input does work. extern has other meaning, use input:
input int abc=123;
extern is the very old way and obsolete for that purpose so use:
input static input sinputThese should all work.
extern in new version is a shared external variable (declared in different files)
Interesting, I did not notice that either.
Such tiny syntax changes move the MQL5 more apart from the MQL4 syntax (which is frozen currently). I am starting to doubt whether my attempt to unify my classes for use in both platforms had any sense.
Interesante, no me di cuenta de que tampoco.
Tales cambios de sintaxis diminutas mover el MQL5 más aparte de la sintaxis MQL4 (que se congela en la actualidad). Estoy empezando a dudar de que mi intento de unificar mis clases para su uso en ambas plataformas tenía ningún sentido.
I think it is not very hard to retain the extern variable functionality in MQL5.
input ulong ulInpNotSoMagicID = 123; //this is our test input variable ulong ulMQL4ExtNotSoMagicID; //this is the MQL4 extern-like variable //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { Print("Initialization"); ulMQL4ExtNotSoMagicID = ulInpNotSoMagicID; return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { ulMQL4ExtNotSoMagicID++; Print("Modified input variable: ", ulMQL4ExtNotSoMagicID); }
Since the modification of an input variable invokes the OnInit() function we can synchronize our extern-like variable there. And since it is not an input variable we can modify it anywhere in the program.
maybe this can be added to https://www.mql5.com/en/articles/81 ?
that extern is obsolete and what to use instead
and it could be helpful in the MQL5 help under "extern" to mention that extern variables are not going to be visible in the inputs dialog- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
To use as a replacement for external variables. (Extern int, extern string, etc?
thanks