明天特斯拉會發布fsd v14,這會導致TA完全沒有用啊,哈哈,這是對應的tradeview 的代碼
//@version=5
indicator(" TradingView (AA/BB/CC/DD)", overlay=true)
// EMA lengths (same as your code)
len1 = 5
len2 = 10
len3 = 20
// EMAs
ema5 = ta.ema(close, len1)
ema10 = ta.ema(close, len2)
ema20 = ta.ema(close, len3)
// Conditions (mapping CROSS(a,b) -> ta.crossover(a,b) meaning a crosses above b)
// AA: price crosses above EMA5, EMA10 and EMA20 (all three cross-ups same bar)
AA = ta.crossover(close, ema5) and ta.crossover(close, ema10) and ta.crossover(close, ema20)
// BB: EMA5 and EMA10 cross above price (both EMAs cross up through price)
BB = ta.crossover(ema5, close) and ta.crossover(ema10, close)
// CC: price crosses above EMA5 and EMA10
CC = ta.crossover(close, ema5) and ta.crossover(close, ema10)
// DD: EMA5, EMA10 and EMA20 cross above price (all three EMAs cross up through price)
DD = ta.crossover(ema5, close) and ta.crossover(ema10, close) and ta.crossover(ema20, close)
// Plot EMAs (optional, you can hide them)
plot(ema5, title="EMA 5", linewidth=1)
plot(ema10, title="EMA 10", linewidth=1)
plot(ema20, title="EMA 20", linewidth=1)
// Visual signals: use shapes for sticklines and labels for the '3' drawtext
plotshape(AA, title="AA (green up)", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.green)
plotshape(BB, title="BB (red down)", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red)
plotshape(CC, title="CC (green small)",location=location.belowbar, style=shape.circle, size=size.tiny, color=color.green)
plotshape(DD, title="DD (red small)", location=location.abovebar, style=shape.xcross, size=size.tiny, color=color.red)
// DRAWTEXT equivalents: put a '3' label (AA green above bar; DD red above bar like original)
if AA
label.new(bar_index, high * 1.02, text="3", style=label.style_label_up, color=color.new(color.green, 0), textcolor=color.white)
if DD
label.new(bar_index, high * 1.02, text="3", style=label.style_label_down, color=color.new(color.red, 0), textcolor=color.white)