Download MetaTrader 5

MQL4/MQL5

To add comments, please log in or register
Farhad Bafkar
380
Farhad Bafkar 2016.03.22 01:16 

Hello,

How can I write this MQL4 code in MQL5?

     for(int r=1; r<11 ; r++)
        ATR_SUM=ATR_SUM+(iATR(Symbol(),Period(),14,r));
     ATR_TP=(ATR_SUM/10);    

in MQL4 there is shift parameter which is not on MQL5!

MQL4:

double  iATR(
   string       symbol,     // symbol
   int          timeframe,  // timeframe
   int          period,     // averaging period
   int          shift       // shift
   );

MQL5: 

int  iATR(
   string           symbol,        // symbol name
   ENUM_TIMEFRAMES  period,        // period
   int              ma_period      // averaging period 
   ); 

Aleksei Beliakov
25351
Aleksei Beliakov 2016.03.22 03:15  

it can help you 

https://www.mql5.com/en/docs/indicators/iatr 

Documentation on MQL5: Technical Indicators / iATR
Documentation on MQL5: Technical Indicators / iATR
  • www.mql5.com
Technical Indicators / iATR - Reference on algorithmic/automated trading language for MetaTrader 5
Farhad Bafkar
380
Farhad Bafkar 2016.03.22 16:30  

Thank you Aleksei, but I did not get anything:(

what happened to shift parameter? how can I calculate something about a candle in the past?

To add comments, please log in or register