This Pine Script calculates and displays average prices for two specific time ranges during a trading day: from 09:00 to 22:30 and from 22:30 to 09:00. It updates the average prices by summing the closing prices in each time frame and then plots them as green and red lines, respectively. The script also displays black lines outside these specific time ranges to prevent "gaps" in the chart during off-peak hours. The displayed lines are dynamically adjusted based on the current time, with the green line for 09:00-22:30 and the red line for 22:30-09:00.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.