Im trying to make an Volume indicator that compare Volume on the current bar to the same bar the week before and one that compare to the same bar the day before, but im getting stuck and out off ideas.
On a 10min graf i first try with Volume[0] – Volume[144], but since IG have trading for a few bars on sundays it all falls apart..
On the 1Day graf i try with Volume-Volume[6], but have the same problem coz off holidays ect…
I think i need to use Intradaybarindex for the intraday version and dayoffweek for the 1D version, but dont know how..
Whant to be able to gett an SMA on the same data too (compare current day to a 5 or 10 day Average off that same bar/day).
Thanks in andvance!
Found a sloution with ChatGPT using loops, so now it seems to work as intenden.
But found another problem when trying on the 1 day graf:
When i use DayOffWeek = 5 it counts both thursday and friday but DayOffWeek = 1 gives me sunday.
What is the reason for this?
Because DayOfWeek is the day of the week when a candle closes, so on Thursday night it closes on Friday as well as on Friday because there’s no day after that.
On Sunday, which is DayOfWeek 0, it returns 1 because the sunday candle closes on Monday.
Use OpenDayOfWeek instead, which is the day of the week when a candle opens.