寫了一個大概的框架,需要把對應的下單條件,下單平倉語句填寫進去就行
下單條件:=;
variable:n=0;
if 下單條件 and holding=0 then begin
下單語句;
n:=h;
end
if h>n then n:=h;
if holding>0 and enterprice-c>7*mindiff then 平倉語句;
if n-enterprice>20*mindiff and (n-h)/n<=0.2 then 平倉語句;
[此貼子已經(jīng)被作者于2013/9/29 10:10:50編輯過]
variable:n=0;
if 開多條件 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);//移動止盈多
if 平多條件 then sell(holding>0,0,market);
if 開空條件 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);//移動止盈空
if 平空條件 and holding<0 then sellshort(1,0,market);