How to find Second M15th Candle Open price of the day

To add comments, please log in or register
Bala ji
93
Bala ji  

Guys, Need help with syntax.

I need to find Second Candle of the day's Open Price

The code below works for first half an hour of the day, then it does not produce the result i want because of "0"(Current Candle). Kindly guide me with the right syntax. 

if (iOpen(Symbol(),PERIOD_D1,0) == iOpen(Symbol(),PERIOD_M15, 0))

  {
   //"display symbol"
  }

 What is the syntax to find the Open or high or low of the user desired n th candle of the day. Thank you in advance guys.
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Calculations of technical indicators require price values and/or values of volumes, on which calculations will be performed. There are 7 predefined identifiers from the ENUM_APPLIED_PRICE enumeration, used to specify the desired price base for calculations. If a technical indicator uses for calculations price data, type of which is set by...
William Roeder
21958
William Roeder  

Bala ji:

The code below works for first half an hour of the day,
if (iOpen(Symbol(),PERIOD_D1,0) == iOpen(Symbol(),PERIOD_M15, 0))

What is the syntax to find the Open or high or low of the user desired x th candle of the day.

  1. No it doesn't; only for the first 15 minutes. After that you have a new M15 open.

  2. Doubles are rarely equal. Understand the links in:
              The == operand. - MQL4 programming forum 2013
  3. 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

    On MT5: Unless the chart is that specific pair/TF, you must synchronize the terminal Data from the Server.
              Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum
              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
              SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum 2019.09.03
              OnCalculate during weekend MT5 - General - MQL5 programming forum

  4. Find the index of the first of the day candle and subtract x.
    datetime today = date();
    int      iM15  = iBarShift(_Symbol, PERIOD_M15, today);
    double   open_m15_first  = iOpen(Symbol(),PERIOD_M15, iM15),
             open_m15_second = iOpen(Symbol(),PERIOD_M15, iM15-1),
              Find bar of the same time one day ago - MQL4 programming forum

  5. Do you really mean the M15 (irregardless of the chart,) or do you mean the current chart's TF? (PERIOD_CURRENT)
  6. Do you understand that unless your broker uses NY+7 timezone, what you are looking at is meanningless for forex.
              When is the time zone problem going to be fixed? - General - MQL5 programming forum 2020.05.07
Ahmet Metin Yilmaz
5381
Ahmet Metin Yilmaz  
Bala ji:

Guys, Need help with syntax.

I need to find Second Candle of the day's Open Price

The code below works for first half an hour of the day, then it does not produce the result i want because of "0"(Current Candle). Kindly guide me with the right syntax. 


 What is the syntax to find the Open or high or low of the user desired x th candle of the day. Thank you in advance guys.

I dont know how exactly but you can do smth with iBarShift()

Ahmet Metin Yilmaz
5381
Ahmet Metin Yilmaz  
and William wrote first , sorry I did not see your answer while writing :)
Bala ji
93
Bala ji  
William Roeder:
  1. No it doesn't; only for the first 15 minutes. After that you have a new M15 open.

  2. Doubles are rarely equal. Understand the links in:
              The == operand. - MQL4 programming forum 2013
  3. 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

    On MT5: Unless the chart is that specific pair/TF, you must synchronize the terminal Data from the Server.
              Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum
              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
              SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum 2019.09.03
              OnCalculate during weekend MT5 - General - MQL5 programming forum

  4. Find the index of the first of the day candle and subtract x.           Find bar of the same time one day ago - MQL4 programming forum

  5. Do you really mean the M15 (irregardless of the chart,) or do you mean the current chart's TF? (PERIOD_CURRENT)
  6. Do you understand that unless your broker uses NY+7 timezone, what you are looking at is meanningless for forex.
              When is the time zone problem going to be fixed? - General - MQL5 programming forum 2020.05.07

Thank you Sir. Will try by your guidance and get back to you. I am trying to experiment with code and creating logic sir. Thank you for your guidance again.

Bala ji
93
Bala ji  
Ahmet Metin Yilmaz:

I dont know how exactly but you can do smth with iBarShift()

Thank you for your replay sir. Thanks agian. 

To add comments, please log in or register