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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [交易系统]超级日内组合策略

   

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


  共有16184人关注过本帖平板打印复制链接

主题:[交易系统]超级日内组合策略

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


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[交易系统]超级日内组合策略  发帖心情 Post By:2011/11/18 21:51:43 [只看该作者]

图片点击可在新窗口打开查看

 

 

runmode:0;

input:waitperiodmins(30);
input:inittradesendtime(143000);
input:liqrevendtime(110000);
input:thrustprcnt1(0.3);
input:thrustprcnt2(0.6);
input:breakoutprcnt(0.25);
input:failedbreakoutprcnt(0.25);
input:protstopprcnt1(0.25);
input:protstopprcnt2(0.15);
input:protstopamt(3);
input:breakevenprcnt(0.5);
input:avgrnglength(10);
input:avgoclength(10);

variable:averagerange=0;
variable:averageocrange=0;
variable:cantrade=0;
variable:buyeasierday=false;
variable:selleasierday=false;
variable:buybopoint=0;
variable:sellbopoint=0;
variable:longbreakpt=0;
variable:shortbreakpt=0;
variable:longfbopoint=0;
variable:shortfbopoint=0;
variable:barcount=0;
variable:intrahigh=0;
variable:intralow=999999;
variable:buystoday=0;
variable:sellstoday=0;
variable:currtrdtype=0;
variable:longliqpoint=0;
variable:shortliqpoint=0;
variable:yesterdayocrrange=0;
variable:intratradehigh=0;
variable:intratradelow=999999;

m1:=ref(ma(callstock(stklabel,vthigh,6,0)-callstock(stklabel,vtlow,6,0),10),1);
m2:=ref(ma(abs(callstock(stklabel,vtopen,6,0)-callstock(stklabel,vtclose,6,0)),10),1);
m3:=ref(llv(low,3),1);
m4:=ref(hhv(high,3),1);

if date>ref(date,1) then begin
 averagerange:=m1;
 yesterdayocrrange:=abs(open-close);
 averageocrange:=m2;
 cantrade:=0;
 
 if yesterdayocrrange<0.85*averageocrange then cantrade:=1;
 buyeasierday:=false;
 selleasierday:=false;
 
 if callstock(stklabel,vtclose,6,-1)<=callstock(stklabel,vtclose,6,-2) then buyeasierday:=true;
 if callstock(stklabel,vtclose,6,-1)>callstock(stklabel,vtclose,6,-2) then selleasierday:=true;
 
 if buyeasierday then begin
  buybopoint:=callstock(stklabel,vtopen,6,0)+thrustprcnt1*averagerange;
  sellbopoint:=callstock(stklabel,vtopen,6,0)-thrustprcnt2*averagerange;
 end
 
 if selleasierday then begin
  sellbopoint:=callstock(stklabel,vtopen,6,0)-thrustprcnt1*averagerange;
  buybopoint:=callstock(stklabel,vtopen,6,0)+thrustprcnt2*averagerange;
 end
 
 longbreakpt:=callstock(stklabel,vthigh,6,-1)+breakoutprcnt*averagerange;
 shortbreakpt:=callstock(stklabel,vtlow,6,-1)-breakoutprcnt*averagerange;
 shortfbopoint:=callstock(stklabel,vthigh,6,-1)-failedbreakoutprcnt*averagerange;
 longfbopoint:=callstock(stklabel,vtlow,6,-1)+failedbreakoutprcnt*averagerange;
 
 barcount:=0;
 intrahigh:=0;
 intralow:=999999;
 buystoday:=0;
 sellstoday:=0;
 currtrdtype:=0;
end

if high>intrahigh then intrahigh:=high;
if low<intralow then intralow:=low;

barcount:=barcount+1;

if barcount>waitperiodmins/datatype and cantrade=1 then begin
 if holding=0 then begin
  intratradehigh:=0;
  intratradelow:=999999;
 end
 
 if holding>0 then begin
  intratradehigh:=max(intratradehigh,high);
  buystoday:=1;
 end
 
 if holding<0 then begin
  intratradelow:=min(intratradelow,low);
  sellstoday:=1;
 end
 
 if buystoday=0 and time<inittradesendtime then
  LBreakOut:buy(1,1,stop,buybopoint);
  
 if sellstoday=0 and time<inittradesendtime then
  SBreakout:sellshort(1,1,stop,sellbopoint); 
  
 if intrahigh>longbreakpt and sellstoday=0 and time<inittradesendtime then
  SfailedBO:sellshort(1,1,stop,shortfbopoint);
  
 if intralow<shortbreakpt and buystoday=0 and time<inittradesendtime then
  BfeiledBO:buy(1,1,stop,longfbopoint); 
  
 if holding>0 then begin
  longliqpoint:=enterprice-protstopprcnt1*averagerange;
  longliqpoint:=min(longliqpoint,enterprice-protstopamt);
  
  if ref(holding,1)<0 and enterbars>=1 and ref(high,1)>=shortliqpoint and shortliqpoint<shortfbopoint then
   currtrdtype:=-2;
  
  if currtrdtype=-2 then begin
   longliqpoint:=enterprice-protstopprcnt2*averagerange;
   longliqpoint:=min(longliqpoint,enterprice-protstopamt);
  end 
  
  if intratradehigh>=enterprice+breakevenprcnt*averagerange then
   longliqpoint:=enterprice;
   
  if time>=inittradesendtime then
   longliqpoint:=max(longliqpoint,m3);
   
  if time<liqrevendtime and sellstoday=0 and longliqpoint<>enterprice and enterbars>=4 then begin
   LongLiqRev:sellshort(1,1,stop,longliqpoint);
  end else begin
   LongLiq:sell(1,1,stop,longliqpoint);
  end   
 end  
 
 if holding<0 then begin
  shortliqpoint:=enterprice+protstopprcnt1*averagerange;
  shortliqpoint:=max(shortliqpoint,enterprice+protstopamt);
  
  if ref(holding,1)<0 and enterbars>=1 and ref(low,1)<longliqpoint and longliqpoint>longfbopoint then
   currtrdtype:=2;
   
  if currtrdtype=2 then begin
   shortliqpoint:=enterprice+protstopprcnt2*averagerange;
   shortliqpoint:=max(shortliqpoint,enterprice+protstopamt);
  end 
  
  if intratradelow<=enterprice-breakevenprcnt*averagerange then
   shortliqpoint:=enterprice;
   
  if time>=inittradesendtime then
   shortliqpoint:=min(shortliqpoint,m4);
   
  if time<liqrevendtime and buystoday=0 and shortliqpoint<>enterprice and enterbars>=4 then begin
   ShortLiqRev:buy(1,1,stop,shortliqpoint);
  end else begin
   ShortLiq:sellshort(1,1,stop,shortliqpoint);
  end  
 end
end

if time>=closetime(0) then begin
 sell(1,holding,limitr,close);
 sellshort(1,holding,limitr,close);
end

盈亏:asset-500000,noaxis,coloryellow,linethick2;

[此贴子已经被作者于2011-11-18 22:33:16编辑过]

 回到顶部