如果策略在套用於圖表時沒有生成單個訂單,並且圖表圖例中沒有錯誤(在頂部),則表示訂單生成的條件未達到或訂單已生成但從未滿足市場價格。
您可以在策略原始碼中增加繪圖,以在圖表上查看何時條件滿足/不可見。這是我們的空白策略腳本的修改代碼,演示如何執行此操作(請留意 plotshape 函數):
//@version=3
strategy("My Strategy", overlay=true)
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
plotshape(longCondition, color = blue)
shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
strategy.entry("My Short Entry Id", strategy.short)
plotshape(shortCondition, color = red)
如果滿足條件,您將在K線上方看到紅色和藍色十字形。