SelScriptFonksiyonlar
strategy.exit
Eşleşen giriş için fiyat bazlı SL/TP tanımlar.
Eşleşen giriş için fiyat bazlı SL/TP tanımlar.
| Parametre | Tür | Varsayılan |
|---|---|---|
id | string | Zorunlu |
from_entry | string | Zorunlu |
stop | number | null |
limit | number | null |
Dönüş: void. Koşul içinde çağrılabilir.
//@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)