Hi
how can i get the time of 10th candle later on H1 timeframe?
datetime TimeCurrentPlusTenCandleOfOneHour = TimeCurrent() + (10 * 3600);
Hi
how can i get the time of 10th candle later on H1 timeframe?
You can't for certain as there may be missing bars (weekend or the symbol is not traded 24 hours per day) unless there are already 10 bars formed after the point that you are checking.
You can check back and see if the current bar is the tenth bar after a certain point.
datetime nowH1 = TimeCurrent(); nowH1 -= nowH1 % PeriodSeconds(PERIOD_H1); datetime TimeCurrentPlusTenCandleOfOneHour = nowH1 + (10 * 3600);This assumes every bar every exists. 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
No candle if open = close ? - MQL4 and MetaTrader 4 - MQL4 programming forum
This assumes every bar every exists. 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
No candle if open = close ? - MQL4 and MetaTrader 4 - MQL4 programming forum
thanks alot
datetime Next_10_Candle = PERIOD_M1 + ( 10 * 60 );
datetime Next_10_Candle = PERIOD_H1 + ( 10 * 1 );
or
datetime Next_10_Candle = PERIOD_M1 + ( 600 * PERIOD_M1 );
datetime Next_10_Candle = PERIOD_H1 + ( 10 * PERIOD_H1 );
TRY.
datetime Next_10_Candle = PERIOD_M1 + ( 10 * 60 );
datetime Next_10_Candle = PERIOD_H1 + ( 10 * 1 );
or
datetime Next_10_Candle = PERIOD_M1 + ( 600 * PERIOD_M1 );
datetime Next_10_Candle = PERIOD_H1 + ( 10 * PERIOD_H1 );
TRY.
I have no idea what you are trying to achieve here!
PERIOD_M1 etc. are enumerations, they are not datetime.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
how can i get the time of 10th candle later on H1 timeframe?