Identify the 2nd last minute candle from the previous day?

 

Hello MQL Community,

I am trying to identify the second last M1 candle from the previous day.

I am currently using a simple:

YesterdayClosePrice = iClose(Symbol(), PERIOD_D1, 1);

I've found different brokers have wildly different close prices, I would like to reference the 2nd last or 5th last minute of the previous day.

Can anyone point me in the right direction? :)

Thank in advanced

 
Chris:

Hello MQL Community,

I am trying to identify the second last M1 candle from the previous day.

I am currently using a simple:

I've found different brokers have wildly different close prices, I would like to reference the 2nd last or 5th last minute of the previous day.

Can anyone point me in the right direction? :)

Thank in advanced

If you want minute bar information it is no good using the daily period use the minute period

As you won't know the index number fo the bar you should use copyrates insted of iClose  then you can specify the time period that you require

 
Chris: I am trying to identify the second last M1 candle from the previous day.
  1. Get the time
  2. Get the time of the beginning of the day.
              Find bar of the same time one day ago - MQL4 programming forum 2017.10.06
  3. Get the M1 shift for BOD
  4. One more is the Last M1 of the previous trading day.
  5. 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 - Forex Calendar - MQL4 programming forum - Page 3 #26.4 2019.05.20

    The function linked to, opens a hidden chart for the symbol/TF in question (if not already open), thus updating history, and temporarily placing the symbol on Market Watch (if not already there), so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero on the first call.

    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.12.15
              Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum 2019.05.31
              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.07.17
              SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum 2019.09.03
              OnCalculate during weekend MT5 - General - MQL5 programming forum