Bruno Brandão:
I understand that this is the way MetaTrader choses to represent the H2 timeframe.
How can I solve this problem without manually calculating a 2-hour bar that starts at 09:00 and ends at 11:00?- It is your broker who choose. There are (non-24 hour markets) with H4 candles that start on odd hours.
Why My XAUUSD 4H candles start with 1 hour shift? - Currency Pairs - General - MQL5 programming forum 2019.04.10
H4 first opened candle - MT5 - General - MQL5 programming forum 2020.09.11And H1 on the half hour).
-
What problem?
- It is your broker who choose.
-
What problem?
The problem is that the VWAP in H2 timeframe will eventually calculate just one bar of H1 because the asset starts at odd hours. In my example, an asset started at 09:00 but since my broker start this period on H2 as 08:00, my VWAP will just calculate one hour of the remaining period.
As I am calling the VWAP from the indicator with H2 timeframe, each bar will represent a 2 hour period.This is a problem because the calculation is outputting wrong values since it starts the day calculating just the 09:00 hour, the desired would be 09:00 - 11:00 not the current 09:00 - 10:00 (that is represented by 08:00-10:00, but at 08:00 the market is closed.
I have uploaded an image
The problem is that the VWAP in H2 timeframe will eventually calculate just one bar of H1 because the asset starts at odd hours. In my example, an asset started at 09:00 but since my broker start this period on H2 as 08:00, my VWAP will just calculate one hour of the remaining period.
As I am calling the VWAP from the indicator with H2 timeframe, each bar will represent a 2 hour period.This is a problem because the calculation is outputting wrong values since it starts the day calculating just the 09:00 hour, the desired would be 09:00 - 11:00 not the current 09:00 - 10:00 (that is represented by 08:00-10:00, but at 08:00 the market is closed.
I have uploaded an image
VWAP indicator is cumulative over the duration, so there is no need to base it on H2 when on M5. Just change the VWAP code in order for it to have a starting time and a duration, or an offset and a period, which ever fits your needs better.
EDIT: If you don't know how to change the VWAP code then place a request in the Freelance Jobs section and discuss it with the prospective coders.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When I chose the H2 timeframe, the bar that opens at 09:00 seems to be opened at 08:00, I understand that this is the way MetaTrader choses to represent the H2 timeframe.
The thing is when use I this VWAP as a multi-timeframe calculated on H2 timeframe on my M5 (5 minute) chart, the first buffer value calculates just one hour (because it starts on 08:00, but since has no value, it computes only 09:00).
How can I solve this problem without manually calculating a 2-hour bar that starts at 09:00 and ends at 11:00?