hey i have german time so i have the issue to set trading hours for a VWAP from 15:30 to 15:30 the next day. maybe its not possible? if yes maybe you know a workaround? Thanks in advance
Hello. first, check your instrument’s Session Template under Data Series properties. Make sure the session defined allows the 15:30 to 15:30 rollover. If you can’t define it there, you gotta go custom.
If didn’t work
- You need to implement a custom VWAP calculation inside your indicator’s code. This allows you to completely ignore the chart’s session settings and enforce your own 24-hour cycle.
- Define Variables: You’ll need to define class-level variables to track the cumulative values throughout your custom session:
SumPriceVolumeandSumVolume. - ession Check & Reset: Inside your
OnBarUpdate(), you need logic to check if the current bar’s timestamp has crossed your 15:30 reset time. When the current bar is the first bar after 15:30, you must force-reset those cumulative variables (SumPriceVolumeandSumVolume) to zero. - Calculation: For every bar in your 24-hour window, you calculate the bar’s
(Typical Price * Volume)and add it toSumPriceVolume. You also add the bar’s volume toSumVolume. The VWAP output is then simplySumPriceVolume / SumVolume.
This specific session rollover challenge often requires custom Indicator optimization that overrides standard session logic. If you need an expertly crafted indicator that strictly enforces your 15:30 to 15:30 session logic across the rollover, I can implement and fine-tune that custom VWAP indicator for you
Trading Hours is what you are looking for. They can absolutely be setup for a 24 session.
Here’s a link to the docs.
hey thanks for the help guys, i found the most easy work around for me was just to make trading hours within another timezone. just put it from my time UTC+1 to UTC+09:30.
now i have one vwap from 00:00-23:00 and one from 15:30-15:29 the next day.