UnknownUnicorn468659

Week of the Year indicator

Simple time indicator showing weeks of the year. Acts to help you define the greater perspective of time on your charts. You can overlay it on the entire chart or use it small and consolidated like I prefer it.

Easiest to configure colors in the script itself and then leave transparency values untouched:
q1w1 = the first week of the first quarter of the year (1st week of january, indicating a new year)
q1= 1-13
q2= 14-26
q3= 27-39
q4=40-53

Hope this helps you, like it helps me.
Best regards,

IMPORTANT NOTE:
Because the scripts asks for the week of the year it doesn't exactly indicate the first day of the quarter of the year. Instead it indicates the year like this: 52 / 4 = 13 W p/Q. Or in other words: 13 weeks per quarter of the year (roughly). Every 5.6 years there's a 53rd week, which will not cause any trouble as long as TV allows the use of the 53rd week, which I think it does.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
study(title="Week of the Year", shorttitle="Week of the Year", overlay=true)
q1w1 = #ffffff
q1 = #0099ff
q2 = #33ccff
q3 = #ff9900
q4 = #fc1687
bgColor =(weekofyear == 1) ? color(q1w1, 0):
    (weekofyear == 2) ? color(q1, 7) :
    (weekofyear == 3) ? color(q1, 14) :
    (weekofyear == 4) ? color(q1, 21) :
    (weekofyear == 5) ? color(q1, 28) :
    (weekofyear == 6) ? color(q1, 35) :
    (weekofyear == 7) ? color(q1, 42) :
    (weekofyear == 8) ? color(q1, 49) :
    (weekofyear == 9) ? color(q1, 56) :
    (weekofyear == 10) ? color(q1, 63) :
    (weekofyear == 11) ? color(q1, 70) :
    (weekofyear == 12) ? color(q1, 77) :
    (weekofyear == 13) ? color(q1, 84) :
    (weekofyear == 14) ? color(q2, 0) :
    (weekofyear == 15) ? color(q2, 7) :
    (weekofyear == 16) ? color(q2, 14) :
    (weekofyear == 17) ? color(q2, 21) :
    (weekofyear == 18) ? color(q2, 28) :
    (weekofyear == 19) ? color(q2, 35) :
    (weekofyear == 20) ? color(q2, 42) :
    (weekofyear == 21) ? color(q2, 49) :
    (weekofyear == 22) ? color(q2, 56) :
    (weekofyear == 23) ? color(q2, 63) :
    (weekofyear == 24) ? color(q2, 70) :
    (weekofyear == 25) ? color(q2, 77) :
    (weekofyear == 26) ? color(q2, 84) :
    (weekofyear == 27) ? color(q3, 0) :
    (weekofyear == 28) ? color(q3, 7) :
    (weekofyear == 29) ? color(q3, 14) :
    (weekofyear == 30) ? color(q3, 21) :
    (weekofyear == 31) ? color(q3, 28) :
    (weekofyear == 32) ? color(q3, 35) :
    (weekofyear == 33) ? color(q3, 42) :
    (weekofyear == 34) ? color(q3, 49) :
    (weekofyear == 35) ? color(q3, 56) :
    (weekofyear == 36) ? color(q3, 63) :
    (weekofyear == 37) ? color(q3, 70) :
    (weekofyear == 38) ? color(q3, 77) :
    (weekofyear == 39) ? color(q3, 84) :
    (weekofyear == 40) ? color(q4, 0) :
    (weekofyear == 41) ? color(q4, 7) :
    (weekofyear == 42) ? color(q4, 14) :
    (weekofyear == 43) ? color(q4, 21) :
    (weekofyear == 44) ? color(q4, 28) :
    (weekofyear == 45) ? color(q4, 35) :
    (weekofyear == 46) ? color(q4, 42) :
    (weekofyear == 47) ? color(q4, 49) :
    (weekofyear == 48) ? color(q4, 56) :
    (weekofyear == 49) ? color(q4, 63) :
    (weekofyear == 50) ? color(q4, 70) :
    (weekofyear == 51) ? color(q4, 77) :
    (weekofyear == 52) ? color(q4, 84) :
    (weekofyear == 53) ? color(q4, 91) :
    color(black, 0)
bgcolor(color=bgColor)