我寫量增交易,但回測發現很多量縮的情況也被選進作交易,請小幫手幫忙了
程式碼如下
input: Day(2,"量增天數"), mount(1,"量比");
variable: i(0), j(0),count(0),count1(0),aa(0);
j = Day-2;
///兩天以上
condition1 = false;
if j>=1 then begin
for i=0 to j begin
value1 = GetField("成交量","D")[i];
value2 = GetField("成交量","D")[i+1];
value3 = value1/value2;
if value3 > mount then begin
count=count+1;
end;
end;
end;
if count = Day-1 then
condition1 = true ;
///兩天
condition2 = false;
if j = 0 then begin
value4 = GetField("成交量","D");
value5 = GetField("volume","D")[1];
aa = value4/value5;
if aa > mount then
count1=1;
end;
if count1 =1 then
condition2 = true;
if condition1 = true or condition2 = true then
ret=1;
回測部分結果如附檔
1 評論