当条件A(波动率大于0.6)一次满足时,满足C>REF(C,5), bk ;节点1
满足C<REF(C,5), sk;节点2
当条件A(波动率大于0.6)二次满足时,满足C>REF(C,5),bk;节点3
满足C<REF(C,5), sp;节点4
满足C>REF(C,5), bp;节点5
满足C<REF(C,5), sk;节点6
当条件A(波动率大于0.6)三次满足时,C>REF(C,5), bk;节点7
满足C<REF(C,5), sp;节点8
满足C>REF(C,5), bk;节点9
满足C<REF(C,5), sk;节点10
满足C>REF(C,5), bk;节点11
满足C<REF(C,5), sk;节点12
满足C>REF(C,5), bp;节点13
满足C<REF(C,5), sk;节点14
日内交易,收盘前5分钟全部平仓,每天开仓总数不超过3次
这个用二叉树来表达交易思想,请稍等,策略正在编写中
//仅供参考
//定义开仓次数
variable:kc:=0;
variable:kcb:=0;
//满足节点1->3->7/8,开3次仓
if date<>ref(date,1) then
begin
if condA and c>ref(c,5) and kc=0 then
begin
buy(1,1,market);
kc:=1;
kcb:=barpos;
if condA and c>ref(c,5) and kc=1 and kcb<>barpos then
begin
buy(1,1,market);
kc:=2;
kcb:=barpos;
if condA and c>ref(c,5) and kc=2 and kcb<>barpos then
begin
buy(1,1,market);
kc:=3;
kcb:=barpos;
end
else if condA and c<ref(c,5) then sellshort(1,0,market);
end
end
end
//满足节点1->4->9/10,开3次仓
if date<>ref(date,1) then
begin
if condA and c>ref(c,5) and kc=0 then
begin
buy(1,1,market);
kc:=1;
kcb:=barpos;
if condA and c<ref(c,5) and kc=1 and kcb<>barpos then
begin
sellshort(1,0,market);
kcb:=barpos;
if condA and c>ref(c,5) and kc=1 and kcb<>barpos then
begin
buy(1,1,market);
kc:=2;
kcb:=barpos;
end
else if condA and c<ref(c,5) then buyshort(1,1,market);
end
end
end
//满足节点2->5->11/12,开3次仓
if date<>ref(date,1) then
begin
if condA and c<ref(c,5) and kc=0 then
begin
buyshort(1,1,market);
kc:=1;
kcb:=barpos;
if condA and c>ref(c,5) and kc=1 and kcb<>barpos then
begin
sell(1,0,market);
kcb:=barpos;
if condA and c>ref(c,5) and kc=1 and kcb<>barpos then
begin
buy(1,1,market);
kc:=2;
kcb:=barpos;
end
else if condA and c<ref(c,5) then buyshort(1,1,market);
end
end
end
//满足节点2->5->13/14,开3次仓
if date<>ref(date,1) then
begin
if condA and c<ref(c,5) and kc=0 then
begin
buyshort(1,1,market);
kc:=1;
kcb:=barpos;
if condA and c<ref(c,5) and kc=1 and kcb<>barpos then
begin
buyshort(1,0,market);
kc:=2;
kcb:=barpos;
if condA and c>ref(c,5) and kc=2 and kcb<>barpos then
begin
sell(1,1,market);
kcb:=barpos;
end
else if condA and c<ref(c,5) then buyshort(1,1,market);
end
end
end
//如果15点收盘,14点55分全部平仓
if time>=145500 then
begin
sell(1,0,market);
sellshort(1,0,market);
end
非常感谢
conda是发帖人自己定义的一个条件。