Multiple TimeFrames.

 
Hello, is it possible to access OHLC values of multiple timeframes in my code. For example I want to access the former 30 min close, while analyzing the current 5 min candle, something like that.
 
Tayebwa Bruno Businge:
Hello, is it possible to access OHLC values of multiple timeframes in my code. For example I want to access the former 30 min close, while analyzing the current 5 min candle, something like that.

study this code, previous day close value is being accessed from timeseries

Price Line 3
Price Line 3
  • www.mql5.com
Shows moving Last Price on Bid Line, LAst 24 hours percentage change, switch chart from arrow keys and more..
 
Tayebwa Bruno Businge:
Hello, is it possible to access OHLC values of multiple timeframes in my code. For example I want to access the former 30 min close, while analyzing the current 5 min candle, something like that.

something like this:

datetime time=iTime(_Symbol,PERIOD_CURRENT,index); // access datetime value of index in current chart
int H4_index = iBarShift(_Symbol,PERIOD_H4,time,false);         // get equivalent index in H4 time frame
return iClose(_Symbol,PERIOD_H4, H4_index );                        // get Close price related to H4 
 
Yashar Seyyedin #: something like this:

Remember, you have to deal with 4066 / synchronization issue.

On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
          Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
          Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
          Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
          Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
          Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
          SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

 
William Roeder #:

Remember, you have to deal with 4066 / synchronization issue.

On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
          Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
          Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
          Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
          Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
          Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
          SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

Thanks ledge