我今天測試同一個策略用微小台跑,但小台可以正常執行微台不行出現 1401 資料不足的錯誤
能請想幫手協助我偵錯嗎? 謝謝
有附上錯誤Log
微型台指期掛牌不到一個月,會不會你計算用的資料超過它的資料筆數?
我用大台的委買賣資料去算濾網,微台只用到價格資訊而已🤔
然後因為是運作在1分K上,頂多也就是用到50分鐘前的資料
Hello Black,
小編會先請相關人員確認您提供的資訊。
但可以的話麻煩提供自動交易策略匯出檔包含腳本,Log也請提供完整的Log。
這樣會比較容易找出原因。
Hello Black,
經相關人員確認,您提供的資料不足以確認問題原因。
麻煩依照上面所說,提供 自動交易策略匯出檔包含腳本 和 完整的 XQ Log。
Log資料夾(預設路徑:C:\SysJust\XQLite\LOG)直接壓縮後提供即可。
您可以直接將檔案上傳,如果檔案過大的話也可以保存到雲端後將連結Mail至客服信箱 XQservice@XQ.com.tw 且務必附上 討論文章連結網址(小編才能盡早處理)。
感謝。
好其後來這怎麼處理好的,我也有這個資料不足的錯誤
// 設定參數
Input: StopLossPoints1(100, "1 口停損點數"),
StopLossPoints2(50, "2 口停損點數"),
ProfitAddPoints(50, "加碼獲利點數"),
MaxPosition(2, "最大部位數"),
VolumeLookback(30, "最大量 K 棒回溯期數"),
MAExitLookback(20, "均線停利回溯期數");
Var: maxVolClose(0), maExit(0);
// 計算最近 30 根最大量 K 棒的收盤價
maxVolClose = Close[Highest(Volume, VolumeLookback)];
// 計算 20 均線
maExit = Average(Close, MAExitLookback);
// **進場邏輯**
If Position = 0 Then Begin
If Close Cross Above maxVolClose Then Begin
SetPosition(1); // **做多 1 口**
Print("【進場】 做多 1 口 | 參考K棒收盤價:", maxVolClose, " | 均線價格:", maExit);
End
Else If Close Cross Below maxVolClose Then Begin
SetPosition(-1); // **做空 1 口**
Print("【進場】 做空 1 口 | 參考K棒收盤價:", maxVolClose, " | 均線價格:", maExit);
End;
End;
// **停損邏輯**
If Position = 1 Then Begin
If Close <= FilledAvgPrice - StopLossPoints1 Then Begin
Print("【停損】 多單出場 | 停損價:", FilledAvgPrice - StopLossPoints1, " | 均線價格:", maExit);
SetPosition(0); // **1 口多單,跌 100 點停損**
End;
End
Else If Position = -1 Then Begin
If Close >= FilledAvgPrice + StopLossPoints1 Then Begin
Print("【停損】 空單出場 | 停損價:", FilledAvgPrice + StopLossPoints1, " | 均線價格:", maExit);
SetPosition(0); // **1 口空單,漲 100 點停損**
End;
End;
// **加碼機制**
If AbsValue(Filled) < MaxPosition Then Begin
If Position = 1 And Close >= FilledAvgPrice + ProfitAddPoints Then Begin
SetPosition(Position + 1); // **加碼多單**
Print("【加碼】 多單加碼至", Position, "口 | 參考K棒收盤價:", maxVolClose, " | 均線價格:", maExit);
End
Else If Position = -1 And Close <= FilledAvgPrice - ProfitAddPoints Then Begin
SetPosition(Position - 1); // **加碼空單**
Print("【加碼】 空單加碼至", Position, "口 | 參考K棒收盤價:", maxVolClose, " | 均線價格:", maExit);
End;
End;
// **2 口部位的停損邏輯**
If Position = 2 Then Begin
If Close <= FilledAvgPrice - StopLossPoints2 Then Begin
Print("【停損】 多單 2 口出場 | 停損價:", FilledAvgPrice - StopLossPoints2, " | 均線價格:", maExit);
SetPosition(0); // **2 口多單,跌 50 點停損**
End;
End
Else If Position = -2 Then Begin
If Close >= FilledAvgPrice + StopLossPoints2 Then Begin
Print("【停損】 空單 2 口出場 | 停損價:", FilledAvgPrice + StopLossPoints2, " | 均線價格:", maExit);
SetPosition(0); // **2 口空單,漲 50 點停損**
End;
End;
// **2 口部位的停利邏輯**
If Position = 2 And Close Cross Below maExit Then Begin
Print("【停利】 多單 2 口出場 | 停利條件: 跌破均線 | 均線價格:", maExit);
SetPosition(0); // **2 口多單,跌破 20 均線停利**
End
Else If Position = -2 And Close Cross Above maExit Then Begin
Print("【停利】 空單 2 口出場 | 停利條件: 漲破均線 | 均線價格:", maExit);
SetPosition(0); // **2 口空單,漲破 20 均線停利**
End;
maxVolClose = Close[HighestBar(Volume, VolumeLookback)];
6 評論