我的策略不执行交易,如何解决?



我正在测试一种新策略,但在我点击";添加到图表",没有交易。我可以知道怎么解决吗?谢谢

//@version=4
strategy("Breakout 3 Weeks High")
Long1 = ema(close, 150) > ema(close, 200)
Long2 = sma(close, 50) > ema(close, 150)
Long3 = ema(close, 21) > sma(close, 50)
Long4 = close > ema(close, 21)
Long5 = crossover(close, high[15])
AvgVol = sum(volume, 50)
Long6 = volume > AvgVol * 1.5
OutofTrade = strategy.position_size <= 0
TimePeriod = time > timestamp(syminfo.timezone, 2010, 01, 01, 0, 0)
if(Long1 and Long2 and Long3 and Long4 and Long5 and Long6 and OutofTrade)
strategy.entry("Long", strategy.long)

if strategy.position_size != 0
StopLoss = strategy.position_avg_price * 0.97
TakeProfit =strategy.position_avg_price * 1.09
strategy.exit("Exit", "Long", stop=StopLoss, limit=TakeProfit)

没有进行交易,因为您正在检查是否所有";longs";同时也是正确的。它们同时为真的可能性很低。写作"或";在语句之间,使程序进行交易。

更改:

if(Long1 and Long2 and Long3 and Long4 and Long5 and Long6 and OutofTrade)
strategy.entry("Long", strategy.long)

收件人:

if(Long1 or Long2 or Long3 or Long4 or Long5 or Long6 or OutofTrade)
strategy.entry("Long", strategy.long)

最新更新