寫了一個(gè)大概的框架,需要把對(duì)應(yīng)的下單條件,下單平倉(cāng)語(yǔ)句填寫進(jìn)去就行
下單條件:=;
variable:n=0;
if 下單條件 and holding=0 then begin
下單語(yǔ)句;
n:=h;
end
if h>n then n:=h;
if holding>0 and enterprice-c>7*mindiff then 平倉(cāng)語(yǔ)句;
if n-enterprice>20*mindiff and (n-h)/n<=0.2 then 平倉(cāng)語(yǔ)句;
[此貼子已經(jīng)被作者于2013/9/29 10:10:50編輯過(guò)]
variable:n=0;
if 開(kāi)多條件 and holding=0 then begin
buy(1,1,market);
n:=h;
end
if h>n then n:=h;
if holding>0 and enterprice-c>7*mindiff then sell(1,0,market);//固定止損多
if n-enterprice>20*mindiff and (n-enterprice)/enterprice<=0.2 then sell(1,0,market);//移動(dòng)止盈多
if 平多條件 then sell(holding>0,0,market);
if 開(kāi)空條件 and holding=0 then begin
buyshort(1,1,market);
n:=l;
end
if l<n then n:=l;
if holding<0 and enterprice-c>7*mindiff then sell(1,0,market);//固定止損空
if enterprice-n>20*mindiff and (enterprice-n)/n<=0.2 then sell(1,0,market);//移動(dòng)止盈空
if 平空條件 and holding<0 then sellshort(1,0,market);