公式网-网站导航


网站搜索:  

公式指标网 发表于2015/10/25 7:09:37

金字塔股指落影模型升级版

金字塔公式 金字塔模型策略源码: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))-110*mindiff,l-110*mindiff);//多单移动止损线
PARTLINE( holding>0, bline, colorrgb(255,0,0));

BLIQCON:= (holding>0 and cross(ma3,ma2)) or (holding>0 and bline>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))+110*mindiff,h+110*mindiff);//空单移动止损线
PARTLINE(holding<0, sline, colorrgb(0,255,0));

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


 buy(BOPEON1,1,market);
 sell(BLIQCON,holding,market);
 buyshort(SOPCON1,1,market);
 sellshort(SLIQCON,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;


复制上述代码粘贴到到公式管理器

 



网站搜索:  



Copyright © 2009-2010 gszb.com ™,All Rights Reserved. 
公式网-www.gszx.com.cn-股票指标公式网