iClose() Is this correct way to get price for specific bars?

 

iClose() Is this correct way to get price for specific bars? What is the equivalent of this iClose() function in MQL5?

How about if I use this iClose() in multi-timeframe/currency then I need to use looping statement? Please give me sample code for better understanding.

Is there any better idea to get price for specific bar in Multi-TimeFrame/Currency Indicators?

 
Musngi:

iClose() Is this correct way to get price for specific bars? What is the equivalent of this iClose() function in MQL5?

How about if I use this iClose() in multi-timeframe/currency then I need to use looping statement? Please give me sample code for better understanding.

Is there any better idea to get price for specific bar in Multi-TimeFrame/Currency Indicators?

18. Timeseries Access ("Migrating from MQL4 to MQL5")

MQL4
 MQL5 Description
double iClose(string symbol,
              int timeframe,
              int shift)
double iCloseMQL4(string symbol,int tf,int index)
{
   if(index < 0) return(-1);
   double Arr[];
   ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
   if(CopyClose(symbol,timeframe, index, 1, Arr)>0) 
        return(Arr[0]);
   else return(-1);
}
Close
Returns Close value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
CopyRates, MqlRates
You will also find more information and answers in the following:
iBars - Timeseries and Indicators Access - MQL4 Reference
iBars - Timeseries and Indicators Access - MQL4 Reference
  • docs.mql4.com
iBars - Timeseries and Indicators Access - MQL4 Reference
 
Fernando Carreiro:

18. Timeseries Access ("Migrating from MQL4 to MQL5")

MQL4
 MQL5 Description
Close
Returns Close value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
CopyRates, MqlRates
You will also find more information and answers in the following:

It means I need to create iClose() function to use it in MQL5. OMG! MQL5 is became low level language. Why MQL Devs keep bringing back C++ programmer Nightmare! LoL

 
Musngi: It means I need to create iClose() function to use it in MQL5. OMG! MQL5 is became low level language. Why MQL Devs keep bringing back C++ programmer Nightmare! LoL

No, you don't have to create the iClose() function in MQL5. It is just that in MQL5 the entire approach is different, and you have to apply a different logic.

It is just that those users that have already become accustomed to the MQL4 logic, feel more comfortable thinking in the same manner and so create "emulator" functions because they prefer using equivalent functionality.

However, in MQL5, you should in fact throw away your MQL4 thinking and learn the completely new way of doing things in the MQL5 logic.