Download MetaTrader 5

Convert Indicator from MT4 to MT5 - SAFEZONE - iMA ISSUES

To add comments, please log in or register
gtcp
7
gtcp  

Hello All,

I`m new at MQL5 forum, and I`m trying to convert the SAFEZONE indicator from MT4 to MT5, but I`m facing some issues, like some times the indicator is showed then left the screen.......

The original code for MT4 I found at https://www.mql5.com/pt/code/7514

Based on MQL5 documentation.... I tried to convert...... and the code is below.

Some one could help to identify the issues...... 

 I trying to Converto the iMA code and I do not know how I add the shift value to MT5.....

 

iMA MT4 code

      double EMA0=iMA(Symbol(),0,EMALength,0,MODE_EMA,0,shift);
      double EMA1=iMA(Symbol(),0,EMALength,0,MODE_EMA,0,shift+1);
      double EMA2=iMA(Symbol(),0,EMALength,0,MODE_EMA,0,shift+2);

 

iMA MT5 code that is missing the last var from MT4 - SHIFT 

      double EMA0=iMA(Symbol(),0,EMALength,0,MODE_EMA,0);
      double EMA1=iMA(Symbol(),0,EMALength,0,MODE_EMA,0);
      double EMA2=iMA(Symbol(),0,EMALength,0,MODE_EMA,0);
Elders Safe Zone
Elders Safe Zone
  • votes: 3
  • 2016.03.29
  • John Smith
  • www.mql5.com
Indicador Elders Safe Zone.
Dr Matthias Hammelsbeck
543
Dr Matthias Hammelsbeck  
gtcp:

Hello All,

I`m new at MQL5 forum, and I`m trying to convert the SAFEZONE indicator from MT4 to MT5, but I`m facing some issues, like some times the indicator is showed then left the screen.......

The original code for MT4 I found at https://www.mql5.com/pt/code/7514

Based on MQL5 documentation.... I tried to convert...... and the code is below.

Some one could help to identify the issues...... 

 I trying to Converto the iMA code and I do not know how I add the shift value to MT5.....

 

iMA MT4 code

 

iMA MT5 code that is missing the last var from MT4 - SHIFT 

Hi,

treatment of indicators is different in MT5.

One idea /proposition  here using the Standard Library:

 

#include <Indicators/Trend.mqh>
CiMA MA_ind;
MA_ind.Create(Symbol(),0,EMALength,0,MODE_EMA,PRICE_CLOSE);
...
double EMA0=MA_ind.Main(shift);
double EMA1=MA_ind.Main(shift+1);
double EMA2=MA_ind.Main(shift+2); 

 

 You can read also https://www.mql5.com/en/articles/81

 

Matthias/Bobcat

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.
To add comments, please log in or register