老師;請教1個(gè)模型的編寫:交易周期15分鐘周期,交易手?jǐn)?shù):2手,每天開倉只一次。交易思路:在每天開盤半小時(shí)后,接下來超過前半小時(shí)最高價(jià)1個(gè)點(diǎn)做多,低于前半小時(shí)最低價(jià)1個(gè)點(diǎn)做空。止損都是15個(gè)點(diǎn)。盈利脫離開倉價(jià)15個(gè)點(diǎn)止損就調(diào)到開倉價(jià)。盈利高過開倉價(jià)30點(diǎn),止盈1手,超過70點(diǎn)止盈另1手,沒到止損 止盈價(jià),就以收盤前1分鐘的收盤價(jià)平倉。謝謝老師!
input:n(2,1,100);
variable:n1=0;//計(jì)算次數(shù)
zuigao:valuewhen(time<=094500,hhv(h,todaybar));//前半個(gè)小時(shí)最高價(jià)
zuidi:valuewhen(time<=094500,llv(l,todaybar));//前半個(gè)小時(shí)最高價(jià)
if h>zuigao and todaybar>2 and n1=0 and time<151500 then begin
buy(holding=0,1,market);
n1:=1;
end
if l<zuidi and todaybar>2 and n1=0 and time<151500 then begin
buyshort(holding=0,1,market);
n1:=1;
end
if c-enterprice>=15*mindiff and holding<0 then sellshort(holding<0,0,market);
if enterprice-c>=15*mindiff and holding>0 then sell(holding>0,0,market);//止損
if c-enterprice>=30*mindiff and holding>0 then sell(holding>0,0,market);
if enterprice-c>=30*mindiff and holding<0 then sellshort(holding<0,0,market);//止盈
if time>=151500 then begin
sell(holding>0,0,market);
sellshort(holding<0,0,market);
n1:=0;
end
if datatype<>3 then exit;
1盈利脫離開倉價(jià)15個(gè)點(diǎn)止損就調(diào)到開倉價(jià),這句不懂
2一天只開一手倉,那么70點(diǎn)的二次止盈就沒啥用了。