MetaEditor

 

Hi everyone.

I was trying to write an script in metaeditor. i wrote the four basic mathematical operations but when I apply the script on chart, the window for input isn't appeared. Despite I add the code #property script_show_inputs

What should I do?

 
Seyedalireza026 :

Hi everyone.

I was trying to write an script in metaeditor. i wrote the four basic mathematical operations but when I apply the script on chart, the window for input isn't appeared. Despite I add the code  #property script_show_inputs

What should I do?

Attach your code using the button Attach file.

 
#property script_show_inputs
extern int x;
extern double y;
double SUM, SUB, MUL, DIV;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
 
    SUM  = x+y;
    SUB = x-y;
    MUL = x*y;
    DIV = x/y;
    
    Comment(SUM, " ",SUB, " ", MUL, " ", DIV);
  }
Vladimir Karputov #:

Attach your code using the button 

one more thing I forgot to mention is that I'm using MetaEditor5 which was downloaded with MT4 and I'm trying to write code with MQL4. Is there any problem with that?

 
Seyedalireza026:

Hi everyone.

I was trying to write an script in metaeditor. i wrote the four basic mathematical operations but when I apply the script on chart, the window for input isn't appeared. Despite I add the code #property script_show_inputs

What should I do?

The input window does appear.

Get out of the habit of using extern unless you have a particular reason to use it. Use input instead.

It is a good idea to give your inputs a default value.

input double y;

is likely to default to zero and so

 DIV = x/y;

will give you a zero divide error.

input double y=1;

will not.

 
Keith Watford #:

The input window does appear.

Get out of the habit of using extern unless you have a particular reason to use it. Use input instead.

It is a good idea to give your inputs a default value.

is likely to default to zero and so

will give you a zero divide error.

will not.

Thanks for the guidance.
Reason: