以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  [原创]落影模型——股指连续开仓  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=3831)

--  作者:luoying
--  发布时间:2010/11/10 18:23:15
--  [原创]落影模型——股指连续开仓

input:P(26,20,100,8);
input:S(12,5,40,4);

input:B1(26,5,300,30);
input:B2(2,0.1,10,1);

input:N2(10,1,120,12);
input:N3(20,1,200,20);
input:N4(60,1,200,20);

ma2:=ma(c,n2);
ma3:=ma(c,n3);
ma4:=ma(c,n4);

MID := MA(CLOSE,B1);
UPPER:= MID + B2*STD(CLOSE,B1);
LOWER:= MID - B2*STD(CLOSE,B1),colorred;

diff := EMA(CLOSE,S) - EMA(CLOSE,P);

variable:vmin = 091500;//用于隔夜高开或低开时间差

if (abs(o-ref(c,1))>=20*MINDIFF AND time>090000 and time<090400) then vmin := 093000;

//开多仓条件:
BOPEON1:=c>upper and diff>0 and c>o and c>ma4 AND HOLDING=0 AND time>vmin AND time<150000;

//平多仓条件:
bline:=IF(holding>0,HHV(HIGH,TYPEBAR(1,1))-40*mindiff,l-40*mindiff);//多单移动止损线
PARTLINE( holding>0, bline, colorrgb(255,0,0));

BLIQCON:= (holding>0 and cross(ma3,ma2)) or (holding>0 and bline>c);

//开空仓条件:
SOPCON_:=bline>c AND time>091400 AND time<151000;

//平空仓条件:
sline_:=IF(holding<0,LLV(LOW,TYPEBAR(1,3))+40*mindiff,H+40*mindiff);//空单移动止损线
PARTLINE(holding<0, sline_, colorrgb(0,255,0));

SLIQCON_:=holding<0 and sline_<c;

//开空仓条件:
SOPCON1:=c<lower and diff<0 and c<o and c<ma4 AND HOLDING=0 AND time>vmin AND time<150000;

//平空仓条件:
sline:=IF(holding<0,LLV(LOW,TYPEBAR(1,3))+40*mindiff,h+40*mindiff);//空单移动止损线
PARTLINE(holding<0, sline, colorrgb(0,255,0));

SLIQCON:= (holding<0 and cross(ma2,ma3)) or (holding<0 and sline<c);

//开多仓条件:
BOPEON_:=sline<c AND time>091400 AND time<151000;

//平多仓条件:
bline_:=IF(holding>0,HHV(HIGH,TYPEBAR(1,1))-40*mindiff,L-40*mindiff);//多单移动止损线
PARTLINE(holding>0, bline_, colorrgb(255,0,0));

BLIQCON_:=holding>0 and bline_>c;


buy(BOPEON1,1,market);
sell(BLIQCON,holding,market);

buyshort(SOPCON_,1,market);
sellshort(SLIQCON_,holding,market);

buyshort(SOPCON1,1,market);
sellshort(SLIQCON,holding,market);

buy(BOPEON_,1,market);
sell(BLIQCON_,holding,market);


//收盘前平仓
sell(time>151000 and holding>0,holding,market);
sellshort(time>151000 and holding<0,holding,market);

可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
资产:ASSET,LINETHICK0;

 

[此贴子已经被作者于2010-11-10 18:23:49编辑过]

--  作者:令狐
--  发布时间:2010/11/10 18:38:08
--  
沙发。不错,有图更好。
--  作者:nhzj2168
--  发布时间:2010/11/13 14:59:50
--  

顶,希望多发精品.