Quarterly Divider [Coded]

// © TheClairvoyant_Trader
//version=6
indicator("Quarterly Divider", overlay=true)
// Input for customizing line color and thickness
lineColor = input.color(color.blue, title="Line Color")
lineThickness = input.int(2, title="Line Thickness", minval=1, maxval=5)
// Define the quarter start dates (1st of Jan, Apr, Jul, and Oct) from 2025 onward
startYear = 2015
quarters = array.new_int(4)
// Add timestamps for each quarter in 2025 and beyond
for year = startYear to year(timenow)
array.push(quarters, timestamp(year, 1, 1, 0, 0)) // Q1
array.push(quarters, timestamp(year, 4, 1, 0, 0)) // Q2
array.push(quarters, timestamp(year, 7, 1, 0, 0)) // Q3
array.push(quarters, timestamp(year, 10, 1, 0, 0)) // Q4
// Loop through the array and draw vertical lines at the start of each quarter
for i = 0 to array.size(quarters) - 1
quarterStartTime = array.get(quarters, i)
if (time >= quarterStartTime) and (time[1] < quarterStartTime)
// Draw vertical lines
line.new(x1=bar_index, x2=bar_index, y1=low, y2=high, color=lineColor, width=lineThickness, extend=extend.both)
// Plot quarter labels below the vertical line (near the timestamp)
quarterLabel = i % 4 == 0 ? "Q1" : i % 4 == 1 ? "Q2" : i % 4 == 2 ? "Q3" : "Q4"
label.new(bar_index, low - (high - low) * 0.1, text=quarterLabel, color=color.blue, style=label.style_label_up, size=size.small)
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact Alpha_002 directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Warning: please read our guide for invite-only scripts before requesting access.
Disclaimer
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact Alpha_002 directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Warning: please read our guide for invite-only scripts before requesting access.