腳本已經編譯完成想要回測
但是回測不出東西
不知道哪裡出錯
{@type:strategy}
// 腳本類型: 策略
// 腳本名稱: 綜合條件策略
// 顯示名稱: 綜合條件策略
// 執行頻率: 1分(非逐筆洗價)
// ========== 參數定義 ==========
Input: priceDeviation(0), volumeLimit(2000), shadowThreshold(2), bigOrderSide(-1);
// ========== 變數定義 ==========
Var: priceCondition(false), volumeCondition(false), shadowCondition(false), bigOrderCondition(false), overallCondition(false);
// ========== 條件一:最新價小於均價線 ==========
SetTotalBar(2);
Var: lastPrice(0), averagePrice(0);
lastPrice = GetField("收盤價");
averagePrice = GetField("均價");
if lastPrice < averagePrice * (1 - (priceDeviation / 100)) then priceCondition = true;
// ========== 條件二:成交量大於等於2000張 ==========
SetTotalBar(1);
if GetField("成交量", "D")[0] >= volumeLimit then volumeCondition = true;
// ========== 條件三:長上影線判斷 ==========
SetBackBar(10, "D");
Var: highPrice(0), bodyReference(0);
highPrice = GetField("最高價", "D");
bodyReference = maxList(GetField("開盤價", "D"), GetField("收盤價", "D"));
if (highPrice - bodyReference) > GetField("收盤價", "D")[1] * shadowThreshold * 0.01 and
(GetField("開盤價", "D") - GetField("收盤價", "D")) < (highPrice - bodyReference) then shadowCondition = true;
// ========== 條件四:大戶持續賣超 ==========
SetTotalBar(3);
Var: orderSellVolume(0), orderBuyVolume(0), netBigOrders(0);
orderSellVolume = GetField("賣出特大單量") + GetField("賣出大單量");
orderBuyVolume = GetField("買進特大單量") + GetField("買進大單量");
netBigOrders = bigOrderSide * (orderBuyVolume - orderSellVolume);
if netBigOrders > 0 then bigOrderCondition = true;
// ========== 綜合條件判斷 ==========
overallCondition = priceCondition and volumeCondition and shadowCondition and bigOrderCondition;
if overallCondition then begin
// 策略執行
Print("策略觸發:所有條件同時成立!");
end;
3 評論