以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请哪位大侠把这个文华模型改编成金字塔模型 谢谢  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=958)

--  作者:天地我心
--  发布时间:2010/2/23 14:21:21
--  请哪位大侠把这个文华模型改编成金字塔模型 谢谢

糖模型

BA:=BARPOS;
VOL1:=IF(LLV(VOL,0)=0,1,INTPART(VOL*100));
HC:=LLV(IF(H-C=0,1000,H-C),0);
CL:=LLV(IF(C-L=0,1000,ABS(C-L)),0);
CO:=LLV(IF(C-O=0,1000,ABS(C-O)),0);
ZXBD:=MIN(HC,MIN(CL,CO));
DFX:=REF(L,2)=LLV(L,15)&&REF(L,1)>REF(L,2)&&L>REF(L,2)&&REF(L,2)<=REF(L,3);
GFX:=REF(H,2)=HHV(H,9)&&REF(H,1)<REF(H,2)&&H<REF(H,2)&&REF(H,2)>=REF(H,3);
DFXI:=VALUEWHEN(DFX,BA);
GFXI:=VALUEWHEN(GFX,BA);
DDP1:=VALUEWHEN(DFX,REF(L,2));
GDP1:=VALUEWHEN(GFX,REF(H,2));
DDP:=VALUEWHEN(DFX&&DDP1<>REF(DDP1,1),DDP1);
GDP:=VALUEWHEN(GFX&&GDP1<>REF(GDP1,1),GDP1);
DFX1I:=VALUEWHEN(DFX,REF(DFXI,1));
DFX1P:=VALUEWHEN(DFX,REF(DDP,BA-DFX1I+1));
GFX1I:=VALUEWHEN(GFX,REF(GFXI,1));
GFX1P:=VALUEWHEN(GFX,REF(GDP,BA-GFX1I+1));
DFXP:=VALUEWHEN(DFX&&DDP<>REF(DDP,1),MIN(DDP,MIN(DFX1P,REF(DDP,1))));
GFXP:=VALUEWHEN(GFX&&GDP<>REF(GDP,1),MAX(GDP,MAX(GFX1P,REF(GDP,1))));
SA:=SAR(4,0.02,0.2);
DZZ:=SA>0&&NOT(REF(SA,1)>0)||BA=0;
G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
REF(DTI>=KTI,1)=1&&DTI<KTI,SPK;

 


--  作者:金钱豹
--  发布时间:2010/2/26 14:22:55
--  

有才,别说改,就是理解一下也挺不容易的。

 


--  作者:admin
--  发布时间:2010/2/26 15:00:22
--  
建议发到理想论坛上去,那里高手比较多一些
--  作者:Likai
--  发布时间:2010/3/1 14:14:24
--  

不能理解原理的东西改了也意义不大。