Я пишу индикатор Pine Script и после компиляции получаю 4 ошибки и одно предупреждение:
(1) предупреждение: аргумент transp
устарел. Вместо этого мы рекомендуем использовать функции color.new() или color.rgb() для указания прозрачности графиков. Кроме того, обратите внимание, что transp
не влияет на графики, где цвет вычисляется во время выполнения.
Это мой код сценария Pine:
'''
//@version=5
// Define the number of bars to be analyzed for finding clusters
clusterLength = input(title = "Cluster Length", defval=100)
// Define the number of standard deviations from the mean to determine the cluster
stdDev = input(title = "Number of Standard Deviations", defval=2.0)
// Calculate the mean and standard deviation for the defined number of bars
mean = ta.sma(close, clusterLength)
stddev = ta.stdev(close, clusterLength)
// Plot the upper and lower bounds of the clusters as horizontal lines
upperBound = mean + stddev * stdDev
lowerBound = mean - stddev * stdDev
hline(upperBound, color=color.red, linewidth=2, title = "Upper Bound")
hline(lowerBound, color=color.blue, linewidth=2, title = "Lower Bound")
// Fill the area between the bounds to visually represent the cluster
fill(upperBound, lowerBound, color=color.gray, transp=70)
'''
Буду признателен, если вы предоставите решение. заранее спасибо
Вы не можете использовать динамические значения в hline()
.
Вместо этого вы можете попробовать использовать plot()
или line
.
И вы должны вызывать функцию fill()
с помощью plot
s или hline
s. upperBound
и lowerBound
— это просто переменные.
Смотрите подпись ниже:
fill(hline1, hline2, color, title, editable, fillgaps, display) → void
fill(plot1, plot2, color, title, editable, show_last, fillgaps, display) → void