Download MetaTrader 5

new version of mql4

To add comments, please log in or register
metbright
101
metbright  

I am confused about new version of mql4.

Can anyone send me some sample indicators (like moving average etc.)? So I will learn by myself.

Thank You.

Sorry for my poor English.

Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
metbright:

I am confused about new version of mql4.

Can anyone send me some sample indicators (like moving average etc.)? So I will learn by myself.

Thank You.

Sorry for my poor English.


Most of the "old" mql4 code still works . . . you will find examples here: https://www.mql5.com/en/code
metbright
101
metbright  

I am really confused new function .

like these

void OnStart();
void OnInit();
void OnDeinit(const int reason);
void OnTick();
void OnTimer();
double OnTester();
void OnChartEvent(const int id,         // Event ID
                  const long& lparam,   // Parameter of type long event
                  const double& dparam, // Parameter of type double event
                  const string& sparam  // Parameter of type string events
  );
int OnCalculate (const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   );
 


In the old version I can use these

int init();
int deinit();
int start();

but now I can't.

Toast
226
Toast  
Have a read of "Changes in MQL4 Language" in the first post here - https://www.mql5.com/en/forum/148851
Ian Venner
2584
Ian Venner  

metbright:

In the old version I can use these

int init();

int deinit();

int start();

but now I can't.


Yes you can. Delete all the OnCalculate() stuff and write,

int start()
{

// you can write code like before, there are some small changes 
// the compiler will notify you about them if neccessary
// or learn about the new mql4 functions its not difficult
// and there are some useful new features to use

return(0);
}
metbright
101
metbright  
Thank you so much to every one, I'll will try.
metbright
101
metbright  

So i will ask one more question?

What are the difference between "extern" and "input" ?

Ian Venner
2584
Ian Venner  

does pretty much the same thing except input variables are constant(value of the variable cannot be changed in the code) and input has more options, you can make drop down lists, use friendly descriptions that appear in the properties dialoge ..

metbright
101
metbright  
SDC:

does pretty much the same thing except input variables are constant(value of the variable cannot be changed in the code) and input has more options, you can make drop down lists, use friendly descriptions that appear in the properties dialoge ..


I understood, thank you very much.


One more question haha.

I can't use debugger in MetaEditor the icon is gray out.

To add comments, please log in or register