Download MetaTrader 5
To add comments, please log in or register
Post web links to other trader's signals and make profit
metbright
101
metbright 2014.03.21 15:48 

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
17963
Simon Gniadkowski 2014.03.21 15:54  
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 2014.03.21 16:11  

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
220
Toast 2014.03.21 16:16  
Have a read of "Changes in MQL4 Language" in the first post here - https://www.mql5.com/en/forum/148851
Ian Venner
2583
Ian Venner 2014.03.21 16:18  

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 2014.03.21 16:50  
Thank you so much to every one, I'll will try.
metbright
101
metbright 2014.03.21 18:36  

So i will ask one more question?

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

Ian Venner
2583
Ian Venner 2014.03.21 19:33  

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 2014.03.21 19:42  
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