Lebihan (overloads) berikut untuk fungsi fill() boleh mencipta kecerunan menegak:
fill(plot1, plot2, top_value, bottom_value, top_color, bottom_color) fill(hline1, hline2, top_value, bottom_value, top_color, bottom_color)
Semua parameter di dalam lebihan (overloads) menerima argumen siri. Mereka mencipta satu kecerunan menegak di antara `top_color` dan `bottom_color` di dalam ruang di antara `top_value` dan `bottom_value`. Plot atau hline yang mana ID digunakan di dalam dua argumen pertama berfungsi sebagai satu pelindung di atas kecerunan, menentukan bahagian mana kecerunan yang kelihatan.
Di sini kami memberikan MACD lama satu rupa baru dengan dua kecerunan menegak, satu untuk mengisikan ruangan di antara dua moving average, dan satu lagi untuk apa yang selalunya diwakili sebagai satu histogram:
//@version=5 indicator("MACD") [macd, signal, hist] = ta.macd(close, 12, 26, 9) // Histogram float maxHist = ta.highest(hist, 100) float minHist = ta.lowest(hist, 100) bool histBull = hist > 0 color topHistColor = histBull ? color.new(color.green, 90) : color.red color botHistColor = histBull ? color.green : color.new(color.red, 90) float topHistValue = histBull ? maxHist : 0 float botHistValue = histBull ? 0 : minHist histPlot = plot(hist, "Histogram", color(na)) centerPlot = plot(0, "Middle", color(na)) fill(histPlot, centerPlot, topHistValue, botHistValue, topHistColor, botHistColor) // Averages float maxLine = ta.highest(math.max(macd, signal), 100) float minLine = ta.lowest(math.min(macd, signal), 100) bool lineBull = macd > signal color topLineColor = lineBull ? color.new(color.lime, 90) : color.fuchsia color botLineColor = lineBull ? color.lime : color.new(color.fuchsia, 90) float topLineValue = lineBull ? maxLine : maxLine float botLineValue = lineBull ? minLine : minLine macdPlot = plot(macd, "MACD", color.gray, 1) signalPlot = plot(signal, "Signal", color.silver, 1) fill(macdPlot, signalPlot, topLineValue, botLineValue, topLineColor, botLineColor)
Di dalam contoh seterusnya, kami mencipta satu hutan Pine menggunakan satu kecerunan untuk latar belakang dan satu lagi untuk garisan pokok berdasarkan RSI:
//@version=5 indicator("Gradient Fill: Night in the Pine forest") // Sky skyTopColor = input.color(color.rgb(144, 191, 249, 1)) skyBotColor = input.color(color.rgb(251, 192, 45, 1)) skyPlot = plot(100, color = skyTopColor) groundPlot = plot(0, color = color.black) fill(skyPlot, groundPlot, 100, 0, skyTopColor, skyBotColor) // Trees crownsVal = ta.rsi(close, 20) treesPlot = plot(crownsVal, color = color.rgb(6, 126, 116)) fill(treesPlot, groundPlot, crownsVal, 0, color.rgb(6, 126, 116), color.black)
Berikut ialah beberapa contoh lagi yang diterbitkan oleh beberapa PineCoder kami di Skrip Komuniti:
Penunjuk Delta Volume Channels oleh LucF
Penunjuk RSI – colour fill oleh Fikira
Penunjuk Webby’s RSI oleh JohnMuchow
Untuk sentiasa terhadapan tentang ciri-ciri Skrip Pine™ baru, perhatikan kepada nota Keluaran Manual Pengguna. Akaun PineCoders juga menyiarkan kemas kini dari Squawk Box nya di Telegram, akaun Twitter nya, dan dari laman sembang awam Soal Jawab Skrip Pine™ di TradingView.
Kami harap anda mendapati ciri yang sangat dipohon ini berguna. Teruskan menghantar kami maklum balas dan cadangan anda untuk penambahbaikan. Kami membina TradingView untuk anda, dan kami sentiasa berminat untuk mendengar dari anda.