//@version=4
study(title="Stochastic RSI", shorttitle="Stoch RSI", format=format.price, precision=2, resolution="")
smoothK = input(3, "K", minval=1)
smoothD = input(3, "D", minval=1)
lengthRSI = input(14, "RSI Length", minval=1)
lengthStoch = input(14, "Stochastic Length", minval=1)
src = input(close, title="RSI Source")
rsi1 = rsi(src, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)
plot(k, "K", color=#2962FF)
plot(d, "D", color=#FF6D00)这是随机RSI的默认脚本。当k和d交叉时,我如何得到y坐标?

发布于 2021-08-24 13:16:11
请注意,有时您不会获得准确的交叉值,因为当前计算的交叉值可能不会出现在条形图中(您只有条形图中的值,例如[2 4]、[6 3],因此它们正在交叉(某处)。
c = cross(k,d)
var float crossPrice = na
if (c)
crossPrice := k // k or d
label.new(bar_index, k, text = tostring( crossPrice ))相同的
c = cross(k,d)
label.new(c? bar_index : na, k, text = tostring( valuewhen(c, k,0) ))https://stackoverflow.com/questions/68881587
复制相似问题