at opening new bar H4 Time[0] == iTime(Symbol (),PERIOD_D1,0);
deVries:
at opening new bar H4 Time[0] == iTime(Symbol (),PERIOD_D1,0);
at opening new bar H4 Time[0] == iTime(Symbol (),PERIOD_D1,0);
That would work with most symbols, but only if the first H4 bar of the day is at midnight (broker time)
GumRai:
That would work with most symbols, but only if the first H4 bar of the day is at midnight (broker time)
That would work with most symbols, but only if the first H4 bar of the day is at midnight (broker time)
OK this can also
bool newday = false; if(iVolume(Symbol (),PERIOD_D1,0) < dayvolume) { newday = true; dayvolume = iVolume(Symbol (),PERIOD_D1,0); } else dayvolume = iVolume(Symbol (),PERIOD_D1,0);
when is this failing ??
RiversideDude:
When I'm on an H4 chart, how do I determine when the bar has closed on a D1 chart?
You cannot, you can only know that a new bar has started.
If you meant what time does a new D1 bar start . . . well it starts at the first tick after midnight Broker time.
If you want to detect the first tick of the new D1 baar then that is easy . . . create a static local variable of a variable with global scope . . .
datetime D1Bar1Time = 0; // global scope variable // or static datetime D1Bar1Time = 0; // static local
then in start() . . .
if(D1Bar1Time == 0) D1Bar1Time = iTime(NULL, PERIOD_D1, 1); if( iTime(NULL, PERIOD_D1, 1) > D1Bar1Time ) { // we have a new D1 bar . . . iTime(NULL, PERIOD_D1, 1) }
GumRai:
That would work with most symbols, but only if the first H4 bar of the day is at midnight (broker time)
Isn't the first H4 bar of a day always starting at midnight (broker time) ?
That would work with most symbols, but only if the first H4 bar of the day is at midnight (broker time)
angevoyageur:
Isn't the first H4 bar of a day always starting at midnight (broker time) ?
Isn't the first H4 bar of a day always starting at midnight (broker time) ?
after a weekend or marketholiday the time of new dailybar will be different from h4 period while both can be a new bar sundaycandle
Ah ok in such a case. All brokers I use doesn't have Sunday candle. Thank you.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
When I'm on an H4 chart, how do I determine when the bar has closed on a D1 chart?
Thanks in advance,
E