Pine script Pine脚本:无法获取Ichimoku前导行的上限(或下限)值
寻找我做错了什么。 我在蜡烛上方得到的曲线图不是上方引线的值(我用下方-->相同的结果进行了尝试) 这是我的密码:Pine script Pine脚本:无法获取Ichimoku前导行的上限(或下限)值,pine-script,Pine Script,寻找我做错了什么。 我在蜡烛上方得到的曲线图不是上方引线的值(我用下方-->相同的结果进行了尝试) 这是我的密码: //@version=4 study(title="Ich1", overlay=true ) var upper_val = 0.1 var lower_val = 1.0 // ichimoku calculations conversionPeriods = input(9, minval=1, title="Conversion
//@version=4
study(title="Ich1", overlay=true )
var upper_val = 0.1
var lower_val = 1.0
// ichimoku calculations
conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods` = input(52, minval=1, title="Lagging Span 2 Periods"),
displacement = input(26, minval=1, title="Displacement")
donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
// plot
plot(conversionLine,color=color.orange,linewidth=4,title="Conversion Line")
plot(baseLine, color=color.purple , linewidth=3, title="Base Line")
plot(close, offset = -displacement + 1, color=#459915, title="Lagging Span")
p1=plot(leadLine1,offset=displacement - 1,color=color.green, title="Lead 1")
p2=plot(leadLine2,offset=displacement - 1,color=color.red, title="Lead 2")
// end plot ichimoku
// rules
if (leadLine1 >= leadLine2)
upper_val := leadLine1
lower_val := leadLine2
else
upper_val := leadLine2
lower_val := leadLine1
target = tostring(upper_val) // can be replaced with:
// target = tostring(upper_val[0])
//print the upper_val
label.new(bar_index, high , yloc = yloc.abovebar, textcolor = color.red, style = label.style_none,
text = target)
您的
上_线的偏移量
等于位移-1
因此,当您调用当前条上的值字符串时,它将显示不带偏移量的值
更改代码第38行以显示偏移量的实际值:
target = tostring(upper_val[displacement - 1])
您的
上_线的偏移量
等于位移-1
因此,当您调用当前条上的值字符串时,它将显示不带偏移量的值
更改代码第38行以显示偏移量的实际值:
target = tostring(upper_val[displacement - 1])