Record High and Low between a time period, and use it later

 

Hello guys, 

I'm new in MQL4, so I have a question. I hope you can help me

I need to record the Highest and the Lowest  between 11:00 AM and 12:00 am - 5 min chart. I need this price to use it later, so i need it static (Not 1 period back for example)

Thank you in advance.

Regards

 
  1. No need to remember it, just compute it when you need it.
         How To Ask Questions The Smart Way. (2004)
              The XY Problem

    Not compiled, not tested just typed.

    datetime hr1200 = date();
    int      iBOD = iBarShift(_Symbol, _Period, hr1200);                // Assuming M5 chart
    
    #define HR1100 39600 // 11 * 3600
    datetime yesterday = date(Time[iBOD-1]);
    datetime hr1100 = yesterday + HR1100;
    int      iHr1100 = iBarShift(_Symbol, _Period, hr1100);             // Assuming M5 chart (note 4)
    
    int      length = iHr100 - iBOD + 1;
    int      iHH = iHighest(_Symbol, _Period, MODE_HIGH, length, iBOD); // Assuming M5 chart
    double   HH = High[iHH];
    Not compiled, not tested just typed.
              date/time (2017)
              Find bar of the same time one day ago - MQL4 programming forum (2017)

  2. You probably don't mean between [11A … 12A]. You probably mean not including 12A bar.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

  3. I assume you are running on the M5. If not adjust and handle 4066
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

  4. Note 4:

    Do not assume that every bar exists — they don't. What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
              "Free-of-Holes" Charts - MQL4 Articles (2006)
              No candle if open = close ? - MQL4 programming forum (2010)

 
William Roeder #:
  1. No need to remember it, just compute it when you need it.
         How To Ask Questions The Smart Way. (2004)
              The XY Problem

    Not compiled, not tested just typed.

    Not compiled, not tested just typed.
              date/time (2017)
              Find bar of the same time one day ago - MQL4 programming forum (2017)

  2. You probably don't mean between [11A … 12A]. You probably mean not including 12A bar.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

  3. I assume you are running on the M5. If not adjust and handle 4066
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)

  4. Note 4:

Thank you very much for your answer. It works perfect now.

Reason: