以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  交易策略发布专区  (http://weistock.com/bbs/list.asp?boardid=10)
----  [交易系统]超级日内组合策略  (http://weistock.com/bbs/dispbbs.asp?boardid=10&id=9037)

--  作者:z7c9
--  发布时间: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编辑过]

--  作者:samyongq
--  发布时间:2011/11/28 15:59:48
--  
没看明白,怎么我用在5分钟的沪铜上就很多白箭头呢?
--  作者:sailersinger
--  发布时间:2011/11/29 16:27:43
--  

测试后全是开多核平多

没有开空和平空


--  作者:tonybig
--  发布时间:2011/12/12 9:59:14
--  
z7c9 是曾超吧?
--  作者:z7c9
--  发布时间:2011/12/12 12:02:03
--  
以下是引用tonybig在2011-12-12 9:59:14的发言:
z7c9 是曾超吧?


--  作者:sailersinger
--  发布时间:2011/12/14 16:28:25
--  
奇了怪了,重装后啥信号也没了
--  作者:just
--  发布时间:2011/12/14 16:36:07
--  
刚刚试过了 有信号的。
--  作者:伍星亮
--  发布时间:2011/12/16 13:22:29
--  
斑竹思路很好。不过资金曲线有失真之处。因为成交价用STOPR,不少地方是成交价不对的。希望改进后再让我们分享你的精华
--  作者:疾风游侠
--  发布时间:2012/4/25 2:38:38
--  
曾超也用TB啊,刚听过你的课。。崇拜中。。。图片点击可在新窗口打开查看
--  作者:cmfyiling
--  发布时间:2012/7/7 22:37:15
--  
???