Selcoin/ docs
SelScriptÖrnek kütüphanesi

Son olay değeri ve etiket

valuewhen ile son kesişim fiyatını saklayıp gösterin.

Kesişim olayı gerçekleştiğinde kapanışı saklar. Yeni olay gelene kadar değer korunur. occurrence=0 son olaydır; önceki mum demek değildir. Henüz olay yoksa çizgi/etiket yoktur.

Son fiyat etiketi yalnız son mumda üretilir; her mumda metin çizilmez. Açık mumdaki olay önizlemesi değişebilir.

Tam kod

//@selscript=1
indicator("Last cross", overlay=true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
cross = ta.crossover(fast, slow)
lastPrice = ta.valuewhen(cross, close, 0)
plot.line(lastPrice, title="Last cross close", color="#f59e0b")
if cross:
    plot.shape(location="belowbar", shape="triangle_up")
if barstate.islast and not is_na(lastPrice):
    plot.label("Last: " + str.tostring(lastPrice, 2), location="abovebar")

Tüm örnekler

Bu sayfada