问题
If MFI or RSI exceeds hline(80) or hline(20), I want to label the bar. Is there anyone who can tell me the script? Thank you ^^
回答1:
An example
//@version=4
study("My Script",overlay=true)
length = input(14),src = input(close)
//----
mfi = mfi(src,length)
rsi = rsi(src,length)
cnd = crossover(mfi,80) or crossover(rsi,80) or crossover(mfi,20) or crossover(rsi,20)
plotshape(cnd ? close : na,location=location.belowbar,text="Text")
You could also use label.new
within an if
statement but plotshape
might be more appropriate in your case.
来源:https://stackoverflow.com/questions/62588280/inquiries-on-how-to-label-bar-when-mfi-or-rsi-hline-is-breakthrough