Download MetaTrader 5

Help ProRealTime code to MQL4

To add comments, please log in or register
Need mobile version of MetaTrader 5? Download it and trade!
Travelfrog
24
Travelfrog 2014.04.18 12:14 

  I am new to MT4 and I am trying to convert some code from ProRealTime to MT4

  I get compile warning "possible loss of data due to type conversion". Can't seem to find how to correct the code.

// c1 =abs( high - low)
   double c1=MathAbs(High[0]-Low[0]);
   // c2 = abs( close[1]-high )
   double c2=MathAbs(Close[1]-High[0]);
   // c3 = abs ( close[1] - low )
   double c3=MathAbs (Close[1]-Low[0]);
   // c4 = max(c1,c2)
   double c4=MathMax(c1,c2);
   // c5 = max(c4,c3)
   double c5=MathMax(c4,c3);
   //atr =Average[P](c5);
   atr =iMA(NULL, 0, Nbr_Periods, 0, MODE_SMA, c5, 0);
Alain Verleyen
Moderator
30739
Alain Verleyen 2014.04.18 19:13  
Travelfrog:

  I am new to MT4 and I am trying to convert some code from ProRealTime to MT4

  I get compile warning "possible loss of data due to type conversion". Can't seem to find how to correct the code.

Your iMA call is not correct, you misunderstood the parameter applied_price. You don't have to provide a price (double), you have to select which price will be used.

Forum on trading, automated trading systems and testing trading strategies


This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.

  • They are more people who can answer there.
  • They are more people who can have similar problem there.
  • A forum is not only to get help but to share with the community, mql4/MT4 community isn't the same as mql5/MT5 community.

Price Constants - MQL4 Documentation
  • docs.mql4.com
Price Constants - MQL4 Documentation
dhornett
116
dhornett 2016.03.15 15:37  
Can anyone help with coding an EA across from Prorealtime to MT4 or MT5 ? 
To add comments, please log in or register