小幫手好
以下程式碼為自動交易腳本
if barcount=1 and _condition1=1
then begin
setposition(-2);
end;
我設定條件看print出來的數值都對 可是回測沒有執行setposition=-2,想請教問題出在哪
看起來 raw data都是對的
回測條件:60k 商品6189 日期2024/02/23 附件為print的raw data
if GetSymbolInfo("買賣現沖")=false or GetSymbolInfo("處置股")=true then raiseruntimeerror("不可當沖");
input:
  Length(20,"MA的天數"),
  UpperBand(2,"上通道標準差倍數"),
  LowerBand(2,"下通道標準差倍數"),
  day(5,"前幾根k棒平均量");
variable: 
  mid(0),up(0),down(0),C5(0);  
up=bollingerband(close,Length,UpperBand);
mid=average(close,Length);
down=bollingerband(close,Length,-1*LowerBand);
C5=average(volume,day);
///變數定義
variable:barcount(0);
///barcount 定義///
if date <> date[1] then ///參數定義
begin
    barcount=1;
end
else
    barcount+=1;
input: openhigh(1.02, "開盤衝高(%)");
input: kill(5, "下殺(%)");
input: highpercent(1.3, "一段時間內衝高幾(%)");
input: period(40, "多長時間內衝高幾趴");
variable: 
  _condition1(0);  
if barcount=1 and c>fastLowest(c,period)*highpercent and o>c[1]*openhigh and (h-c)/h*100>kill
then begin
  _condition1=1;
end;
if barcount=1 and _condition1=1
then begin
setposition(-2);
end;
print(file("C:\print\"),position,barcount,o,c[1]*openhigh,(h-c)/c*100,c,fastLowest(c,period)*highpercent,_condition1);
 
 
             
        
        
 
         
     
     分類
    分類
 
            
5 評論