【发布时间】:2022-06-28 17:55:03
【问题描述】:
//@version=5
strategy("My script")
uptrend = request.security(syminfo.tickerid, "60", (ta.ema(close, 9) > ta.ema(close, 21)))
downtrend = request.security(syminfo.tickerid, "60", (ta.ema(close, 9) < ta.ema(close, 21)))
buy = request.security(syminfo.tickerid, "5", ta.crossover(ta.ema(close, 9), ta.ema(close, 21)))
sell = request.security(syminfo.tickerid, "5", ta.crossunder(ta.ema(close, 9), ta.ema(close, 21)))
if uptrend
if buy
strategy.entry("buy", strategy.long)
if sell
strategy.close("buy")
if downtrend
if sell
strategy.entry("sell", strategy.short)
if buy
strategy.close("sell")
如图所示,在第一个信号出现后,如何执行脚本以忽略其余信号?
【问题讨论】: