Relearn MQL when moving from 4 to 5?

 

Hello! 

I used to write in mql4 and now coming back I'm having a very hard time getting my ea to work using mql5.

One example, in the past I've been able to use something like this: 

for(int i=0;i<10;i++)

{

  variable[i] = iMA(Symbol(),0,13,8,MODE_SMA,PRICE_MEDIAN,i);

This was great! I understand it and my variable[i] will output the value of the index based on the iMA I've pulled in.

 

With mql5 the iMA has the following:

Return Value

Returns the handle of a specified technical indicator,  in case of failure returns INVALID_HANDLE. The computer memory can be freed from an indicator that is no more utilized, using the IndicatorRelease() function, to which the indicator handle is passed.

Instead of pulling the value I want, iMA gives me the handle. I don't understand how to use this handle to get the values of the indicator at a specific index.  

Is anyone able to explain this to me the way you would explain it to a child? OR if possible, is it possible to get the mt4 ide instead of the mt5 (I've tried multiple times to install MT4, yet I get MT5 every time). 

 

It's exactly what the documentation states.

Just read it carefully.

Technical Indicator Functions


All functions like iMA, iAC, iMACD, iIchimoku etc. create a copy of the corresponding technical indicator in the global cache of the client terminal.

If a copy of the indicator with such parameters already exists, the new copy is not created, and the counter of references to the existing copy increases.

These functions return the handle of the appropriate copy of the indicator.

Further, using this handle, you can receive data calculated by the corresponding indicator.

The corresponding buffer data (technical indicators contain calculated data in their internal buffers, which can vary from 1 to 5, depending on the indicator) can be copied to a mql5-program using the CopyBuffer() function.

Please see:

https://www.mql5.com/en/articles/81


If you really want to stick to MT4 you will have to download MT4 from your broker since MetaQuotes does not provide the installer anymore.

Migrating from MQL4 to MQL5
Migrating from MQL4 to MQL5
  • 2010.05.17
  • Sergey Pavlov
  • www.mql5.com
This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.
 
scott: I used to write in mql4 and now coming back I'm having a very hard time getting my ea to work using mql5.
You will have to re-learn everything except the language syntax.