SelScriptFonksiyonlar
ta.cross
`a`, `b`’yi yukarı veya aşağı kestiğinde `true`.
İmza
ta.cross(a, b)Parametreler
| Parametre | Tür | Varsayılan | Kural |
|---|---|---|---|
a | number | Zorunlu | Seri kabul eder |
b | number | Zorunlu | Seri kabul eder |
Davranış ve dönüş
ta.crossover(a, b) or ta.crossunder(a, b) ile aynıdır: güncel a > b ve önceki a <= b ya da güncel a < b ve önceki a >= b. İlk mumda ve önceki veya güncel değerlerden biri eksikse na döner. İki argüman da seri olmalıdır.
Dönüş: bool. Koşulsuz üst seviye değişken tanımı.
Çalışan örnek
//@selscript=1
indicator("Any cross", overlay=true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
flip = ta.cross(fast, slow)
plot.line(fast)
plot.line(slow, color="#f59e0b")
if flip:
plot.shape("abovebar", "circle", "#a855f7")Ortalamalar hangi yönde kesişirse kesişsin mumun üstünde işaret çıkar.
Yaygın hata
ta.cross(close, 50) gibi sabit bir seviye vermek TYPE hatası verir; iki argüman da seri olmalıdır. Sabit seviye için (close > 50) != (close[1] > 50) yazın.
İlgili rehber · Tüm fonksiyonlar
Doğrulanan kapsam: SelScript 1, standart kütüphane 1.7.0.