嗨,我正在努力编码一个指示灯,如果10到12支蜡烛之前我们有一个摇摆高(SH)和当前的RSI是超卖的当前条颜色。此外,如果10至12巴之前,我们有一个摆动低点(SL)和当前的RSI是超买。
SH = open[5] < close[5] and open[4] < close[4] and open[3] < close[3] and open[2] > close[2] and open[1] > close[1] and open[0] > close[0]
SL = open[5] > close[5] and open[4] > close[4] and open[3] > close[3] and open[2] < close[2] and open[1] < close[1] and open[0] < close[0]我对这个问题一无所知
发布于 2022-10-29 21:52:05
//@version=5
indicator("swing/rsi", overlay = true)
swing_start_lb = input.int(10, title = "Start of Swing lookback")
swing_end_lb = input.int(12, title ="End of Swing lookback" )
ob = input.float(80, title = "RSI OB")
os = input.float(20, title = "RSI OS")
SH = open[5] < close[5] and open[4] < close[4] and open[3] < close[3] and open[2] > close[2] and open[1] > close[1] and open[0] > close[0]
SL = open[5] > close[5] and open[4] > close[4] and open[3] > close[3] and open[2] < close[2] and open[1] < close[1] and open[0] < close[0]
plotshape(SH, title = "Swing High", style = shape.triangledown, location = location.abovebar, color = color.red)
plotshape(SL, title = "Swing Low", style = shape.triangleup, location = location.belowbar, color = color.green)
r = ta.rsi(close, 14)
bgcolor(r >= ob ? color.new(color.red, 80) : r <= os ? color.new(color.green, 80) : #00000000)
bool SH_RSIOS_cond = false
bool SL_RSIOB_cond = false
for i = swing_start_lb to swing_end_lb
if SH[i] and r <= os
SH_RSIOS_cond := true
if SL[i] and r >= ob
SL_RSIOB_cond := true
barcolor(SH_RSIOS_cond ? color.aqua : na)
barcolor(SL_RSIOB_cond ? color.fuchsia : na)https://stackoverflow.com/questions/74242866
复制相似问题