Hello everyone,
I want to create an average volume indicator which only considers the volume of the trading hours and neglects the out of trading hours.
In my opinion the out of trading hours delute the average.
Conditions:
1h timeframe
trading hours 07:00 until 22:00
lookback: last 10 bars
Example A: it is 20:00 o’clock. The lookback 10 periods 10:00 – 20:00. Entire average[10] is in trading hours
Example B: its 10:00 o’clock. 10 period lookback should be from 07:00 – 10:00 current day and 15:00 – 22:00 previous day.
Is it possible to create an “While loop” or “for loop” instead of plenty “if-then” conditions?
How do I achieve that in a code?
Does anybody have an idea?
Kind regards