以文本方式查看主题

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

--  作者:z7c9
--  发布时间:2011/10/3 12:48:44
--  [交易系统]动态突破系统

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

 

runmode:0;

input:ceilingamt(60),flooramt(20),bolbandtrig(2);

variable:lookbackdays=20;

todayvolatility:=std(close,30);
yesterdayvolatility:=std(ref(close,1),30);

deltavolatility:=(todayvolatility-yesterdayvolatility)/todayvolatility;

lookbackdays:=lookbackdays*(1+deltavolatility);
lookbackdays:=round(lookbackdays);
lookbackdays:=min(lookbackdays,ceilingamt);
lookbackdays:=max(lookbackdays,flooramt);

mid:=ma(close,lookbackdays);
upband:=mid+bolbandtrig*std(close,lookbackdays);
dnband:=mid-bolbandtrig*std(close,lookbackdays);

buypoint:=ref(hhv(high,lookbackdays),1);
sellpoint:=ref(llv(low,lookbackdays),1);

longliqpoint:=ma(close,lookbackdays);
shortliqpoint:=ma(close,lookbackdays);

if holding=0 then begin
 if close>upband then
  buy(1,1,limitr,max(open,buypoint));
end

if holding=0 then begin
 if close<dnband then
  buyshort(1,1,limitr,min(open,sellpoint));
end

if holding>0 then begin
 if close<dnband then begin
  sell(1,holding,limitr,min(open,sellpoint));
  buyshort(1,1,limitr,min(open,sellpoint));
 end
 
 if low<=longliqpoint then
  sell(1,holding,limitr,min(open,longliqpoint));
end

if holding<0 then begin
 if close>upband then begin
  sellshort(1,holding,limitr,max(open,buypoint));
  buy(1,1,limitr,max(open,buypoint));
 end
 
 if high>=shortliqpoint then
  sellshort(1,holding,limitr,max(open,shortliqpoint));
end

盈亏:asset-50000,noaxis,colorred,linethick2;


--  作者:lilieddove
--  发布时间:2011/10/12 13:12:04
--  

if close>upband then
buy(1,1,limitr,max(open,buypoint));
end

使用了未来数据,按收盘价判断条件,却以开盘价来确定开仓价。


--  作者:淡定688
--  发布时间:2011/10/31 17:46:39
--  

有哪个好心人请帮忙添加注释!

input:ceilingamt(60,15,80,5){????},flooramt(20,5,40,5){???},bolbandtrig(2,1,5,0.5){???};

variable:lookbackdays=20;       //突破周期

todayvolatility:=std(close,30);                    //30周标准差
yesterdayvolatility:=std(ref(close,1),30);     //前周标准差

deltavolatility:=(todayvolatility-yesterdayvolatility)/todayvolatility;   //估算差波动率

lookbackdays:=lookbackdays*(1+deltavolatility);    //突破周期*波动率
lookbackdays:=round(lookbackdays); 
lookbackdays:=min(lookbackdays,ceilingamt);   //    跟下一句可能有冲突????
lookbackdays:=max(lookbackdays,flooramt);     //  ???????

mid:=ma(close,lookbackdays);        
upband:=mid+bolbandtrig*std(close,lookbackdays);
dnband:=mid-bolbandtrig*std(close,lookbackdays);

buypoint:=ref(hhv(high,lookbackdays),1);
sellpoint:=ref(llv(low,lookbackdays),1);

longliqpoint:=ma(close,lookbackdays);
shortliqpoint:=ma(close,lookbackdays);