以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]劳烦老师帮翻译这个代码 想知道模型的思想 谢谢  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=28113)

--  作者:lzql888
--  发布时间:2012/9/18 14:48:00
--  [求助]劳烦老师帮翻译这个代码 想知道模型的思想 谢谢

input:n1(32,6,50,1);

W1:=-100*(HHV(H,N1)-C)/(HHV(H,N1)-LLV(L,N1))+50;
T1:=TIME>093000 AND TIME<143500;
T2:=TIME>150500;

if W1>45 AND REF(ANY(W1>45,9),1) then begin
 sellshort(holding<0, 0, thisclose);
 buy(holding=0 AND T1, 1, thisclose);
 end

if HHV(H,5)>1.0094*C OR T2 then sell(holding>0, 0, thisclose);

if W1<-45 AND REF(ANY(W1<-45,9),1) then begin
 sell(holding>0, 0, thisclose);
 buyshort(holding=0 AND T1, 1, thisclose);
 end

if C>1.0094*LLV(L,5) OR T2 then sellshort(holding<0, 0, thisclose);


谢谢老师、高手帮忙翻译

--  作者:jinzhe
--  发布时间:2012/9/18 14:52:17
--  
我只能帮你解释字面意思,要理解其他的思路你最好是直接去问
--  作者:lzql888
--  发布时间:2012/9/18 14:54:38
--  
嗯 好的 谢谢2楼老师 源码是来自论坛里  http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=12064
没见作者翻译 谢谢

--  作者:jinzhe
--  发布时间:2012/9/18 14:56:16
--  

input:n1(32,6,50,1);//参数n1,默认值为32

W1:=-100*(HHV(H,N1)-C)/(HHV(H,N1)-LLV(L,N1))+50;//定义w1
T1:=TIME>093000 AND TIME<143500;//时间段1,下单时间

T2:=TIME>150500;//时间段2,强平时间

if W1>45 AND REF(ANY(W1>45,9),1) then begin//满足w1>45和 前9个周期中任意一个周期满足w1>45 则平空开多
 sellshort(holding<0, 0, thisclose);
 buy(holding=0 AND T1, 1, thisclose);//开多还需要在T1时间内
 end

if HHV(H,5)>1.0094*C OR T2 then sell(holding>0, 0, thisclose);//5周期最高价> 收盘价*1.0094 或者 T1时间时,平仓

if W1<-45 AND REF(ANY(W1<-45,9),1) then begin//满足w1<-45 和 前9个周期中任意一个周期满足w2<-45,则平多开空
 sell(holding>0, 0, thisclose);
 buyshort(holding=0 AND T1, 1, thisclose);//开空还要在T1时间内
 end

if C>1.0094*LLV(L,5) OR T2 then sellshort(holding<0, 0, thisclose);//收盘价>5周期最低价*1.0094 或者在T2时间时,平空