写了一个大概的框架,需要把对应的下单条件,下单平仓语句填写进去就行
下单条件:=;
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 平仓语句;
[此贴子已经被作者于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);