欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 呼叫阿火版主

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2616人关注过本帖树形打印复制链接

主题:呼叫阿火版主

帅哥哟,离线,有人找我吗?
bizstar
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
呼叫阿火版主  发帖心情 Post By:2013/3/26 10:21:20    Post IP:222.210.88.152[显示全部帖子]

阿火版主,你的这个模型,我试过怎么开仓好像有漏单现象呢。请再开下。谢谢

 

七、把各种模型组合成一个模型的方法,适用于所有模型,即便是“即时下单模型”。

    对于信号在同一个点位的模型(比如都是开盘价),可以实盘图表化交易

     说明:因为图表交易同一根K线出现2个开多信号的话,只会开一次,另外一个无法执行,但是可以做历时回测

             组合起来的模型,加入后台下单语句,就可以用于后台下单,当然,后台下单用“后台下单模板”会更好用。

     方法原理:计算每个时点要下单的手数和方向,再根据holding判断出要平仓和开仓的数量,然后再下单。

看起来很多,其实很简单,最基本得模块就是蓝色部分

input:cang1(1,0,10,1),cang2(1,0,10,1);
variable:cc1=0,cc2=0;

/////////////////////////////////模型1——10周期反手
hi:=ref(hhv(h,10),1);
lo:=ref(llv(l,10),1);
if cc1>0 and l<lo then begin
 pc:=min(max(holding,0),cang1);
 kc:=cang1-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc1:=0;
end
if cc1<0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang1);
 kc:=cang1-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc1:=0;
end
if cc1=0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang1);
 kc:=cang1-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc1:=1;
end
if cc1=0 and l<lo then begin
 pc:=min(max(holding,0),cang1);
 kc:=cang1-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc1:=-1;
end

/////////////////////////////////以上是模型1

/////////////////////////////////模型2——20周期反手
hi:=ref(hhv(h,20),1);
lo:=ref(llv(l,20),1);
if cc2>0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc2:=0;
end
if cc2<0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc2:=0;
end
if cc2=0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc2:=1;
end
if cc2=0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc2:=-1;
end

/////////////////////////////////以上是模型2

//有更多的模型,往后面添加即可

 


 回到顶部