RicardoSantos

[RS]Color Gradient Function

A simple function method to build color gradient palettes to use in scripts
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?
study(title="[RS]Color Gradient Function", overlay=false)
green_ColorScope(value)=>
    value >= 10 ? #0d3d00 :
        value == 09 ? #104c00 :
        value == 08 ? #135b00 :
        value == 07 ? #176b00 :
        value == 06 ? #1a7a00 :
        value == 05 ? #1d8900 :
        value == 04 ? #219900 :
        value == 03 ? #37a319 :
        value == 02 ? #4dad32 :
        value == 01 ? #63b74c : white
red_ColorScope(value)=>
    value >= 10 ? #4c0010 :
        value == 09 ? #5b0013 :
        value == 08 ? #6b0017 :
        value == 07 ? #7a001a :
        value == 06 ? #89001d :
        value == 05 ? #990021 :
        value == 04 ? #a31937 :
        value == 03 ? #ad324d :
        value == 02 ? #b74c63 :
        value == 01 ? #c16679 : white

plot(0.0, color=green_ColorScope(10), linewidth=4)
plot(0.1, color=green_ColorScope(09), linewidth=4)
plot(0.2, color=green_ColorScope(08), linewidth=4)
plot(0.3, color=green_ColorScope(07), linewidth=4)
plot(0.4, color=green_ColorScope(06), linewidth=4)
plot(0.5, color=green_ColorScope(05), linewidth=4)
plot(0.6, color=green_ColorScope(04), linewidth=4)
plot(0.7, color=green_ColorScope(03), linewidth=4)
plot(0.8, color=green_ColorScope(02), linewidth=4)
plot(0.9, color=green_ColorScope(01), linewidth=4)
plot(1.0, color=red_ColorScope(01), linewidth=4)
plot(1.1, color=red_ColorScope(02), linewidth=4)
plot(1.2, color=red_ColorScope(03), linewidth=4)
plot(1.3, color=red_ColorScope(04), linewidth=4)
plot(1.4, color=red_ColorScope(05), linewidth=4)
plot(1.5, color=red_ColorScope(06), linewidth=4)
plot(1.6, color=red_ColorScope(07), linewidth=4)
plot(1.7, color=red_ColorScope(08), linewidth=4)
plot(1.8, color=red_ColorScope(09), linewidth=4)
plot(1.9, color=red_ColorScope(10), linewidth=4)