相關標簽:突破交易策略,惠比特交易和配種專區(qū),夢三國交易專區(qū),夢三國交易專區(qū)速秒,靈緹格力交易專區(qū),中京交易市場下載專區(qū),古幣銀元交易專區(qū),長毛德牧交易專區(qū),夢三國交易專區(qū)在哪里,
模型策略源碼:
runmode:0;
input:volatility(20,5,100,5);
variable:myasset=30000;
entertime:=time>=092500 and time<=145500; //這一句為什么編譯有錯誤???
exittime:=time>=150000;
dist:=barslast(date<>ref(date,1));
oo:=ref(open,dist);
highest:=oo+volatility*mindiff;
lowest:=oo-volatility*mindiff;
buycond:=entertime and high>=highest;
buyprice:=max(open,highest);
buyshortcond:=entertime and low<=lowest;
buyshortprice:=min(open,lowest);
if holding=0 and buycond then begin
buy(1,1,limitr,buyprice);
end
if holding=0 and buyshortcond then begin
buyshort(1,1,limitr,buyshortprice);
end
if holding>0 and exittime then begin
sell(1,holding,limitr,close);
end
if holding<0 and exittime then begin
sellshort(1,holding,limitr,close);
end
if exittime then
myasset:=asset;
資產(chǎn):myasset,noaxis,colormagenta;
次數(shù):totaltrade,linethick0;
收益:(myasset-30000)/30000,linethick0;
勝率:percentwin,linethick0;
出擊:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
連虧:maxseqloss,linethick0;
連贏:maxseqwin,linethick0;
{別忘了將本網(wǎng)告訴您身邊的朋友,向朋友傳達有用資料,也是一種人情,你朋友會感謝你的。}
源碼解析:
輸出RUNMODE:0
輸出 INPUT:VOLATILITY(20,5,100,5)
輸出 VARIABLE:MYASSET=30000
ENTERTIME賦值:時間>=092500 AND 時間<=145500
EXITTIME賦值:時間>=150000
DIST賦值:上次日期<>昨日日期距今天數(shù)
OO賦值:DIST日前的開盤價
HIGHEST賦值:OO+VOLATILITY*MINDIFF
LOWEST賦值:OO-VOLATILITY*MINDIFF
BUYCOND賦值:ENTERTIME AND 最高價>=HIGHEST
BUYPRICE賦值:開盤價和HIGHEST的較大值
BUYSHORTCOND賦值:ENTERTIME AND 最低價<=LOWEST
BUYSHORTPRICE賦值:開盤價和LOWEST的較小值
邏輯判斷 HOLDING=0 AND BUYCOND THEN BEGIN BUY(1,1,LIMITR,BUYPRICE)
END 邏輯判斷 HOLDING=0 AND BUYSHORTCOND THEN BEGIN BUYSHORT(1,1,LIMITR,BUYSHORTPRICE)
END 邏輯判斷 HOLDING>0 AND EXITTIME THEN BEGIN SELL(1,HOLDING,LIMITR,收盤價)
END 邏輯判斷 HOLDING<0 AND EXITTIME THEN BEGIN SELLSHORT(1,HOLDING,LIMITR,收盤價)
MYASSET賦值:ASSET
輸出 資產(chǎn):MYASSET,NOAXIS,畫洋紅色
輸出 次數(shù):TOTALTRADE,線寬為0
輸出 收益:(MYASSET-30000)/30000,線寬為0
輸出 勝率:PERCENTWIN,線寬為0
輸出 出擊:TOTALTRADE/(統(tǒng)計0日中滿足日期<>昨日日期的天數(shù)+1),線寬為0
輸出 連虧:MAXSEQLOSS,線寬為0
輸出 連贏:MAXSEQWIN,線寬為0