SelScriptFonksiyonlar
strategy
Tek simülasyon stratejisini ve grafik panelini bildirir.
Tek simülasyon stratejisini ve grafik panelini bildirir.
| Parametre | Tür | Varsayılan |
|---|---|---|
title | string | Zorunlu |
overlay | bool | true |
Dönüş: void. Üst düzeyde çağrılır.
//@selscript=1
strategy("EMA Simulation", overlay=true)
fast = ta.ema(close, 12)
slow = ta.ema(close, 26)
buy = ta.crossover(fast, slow)
sell = ta.crossunder(fast, slow)
plot.fill(fast, slow, color=fast >= slow ? "#22c55e40" : "#ef444440")
if buy:
strategy.entry("L", strategy.long)
if sell:
strategy.close("L")
if strategy.position_size > 0:
strategy.exit("Protection", "L", stop=strategy.position_avg_price * 0.97, limit=strategy.position_avg_price * 1.06)