以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  引用公式问题  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=142476)

--  作者:tanyongde
--  发布时间:2016/11/10 10:23:45
--  引用公式问题
引用公式“DAYTREND”

input:n(20,0,100,1);
input:m(20,0,100,1);
tr1 := max(max((high-low),abs(ref(close,1)-high)),abs(ref(close,1)-low));
atr1 : =ma(tr1,n);
atr:=ifelse(atr1<0.01*c,0.01*c,ifelse(atr1<0.025*c,atr1,0.025*c));
c1:=(h+l+2*c)/4;         
mam1:ref(ema(c1,m),1);
top1:ref(ema(c1+atr,m),1);
bottom1:ref(ema(c1-atr,m),1);
mam2:ref(ema(c1,5*m),1);
top2:ref(ema(c1+atr,5*m),1);
bottom2:ref(ema(c1-atr,5*m),1);

引用公式“DAYTREND”日周期的指标如下

5mam1:stkindi(\'\',\'DAYTREND.mam1\',6,-1);
5top1:stkindi(\'\',\'DAYTREND.top1\',6,-1);
5bottom1:stkindi(\'\',\'DAYTREND.bottom1\',6,-1);
5mam2:stkindi(\'\',\'DAYTREND.mam2\',6,-1);
5top2:stkindi(\'\',\'DAYTREND.top2\',6,-1);
5bottom2:stkindi(\'\',\'DAYTREND.bottom2\',6,-1);
5atr:=stkindi(\'\',\'DAYTREND.atr\',6,-1);
5emastr:=stkindi(\'\',\'DAYTREND.emastr\',6,-1);

引用公式“DAYTREND”周周期的指标如下

5mam1:stkindi(\'\',\'DAYTREND.mam1\',7,-1);
5top1:stkindi(\'\',\'DAYTREND.top1\',7,-1);
5bottom1:stkindi(\'\',\'DAYTREND.bottom1\',7,-1);
5mam2:stkindi(\'\',\'DAYTREND.mam2\',7,-1);
5top2:stkindi(\'\',\'DAYTREND.top2\',7,-1);
5bottom2:stkindi(\'\',\'DAYTREND.bottom2\',7,-1);
5atr:=stkindi(\'\',\'DAYTREND.atr\',7,-1);
5emastr:=stkindi(\'\',\'DAYTREND.emastr\',7,-1);


  交易模块分别按日周期引用DAYTREND”的指标和按周期的指标DAYTREND”的指标回测结果都是一样的,是编写的问题?







--  作者:jinzhe
--  发布时间:2016/11/10 10:31:33
--  
因为你没写对,所有引用都按照下面改:
5mam1:stkindi(\'\',\'DAYTREND.mam1\',0,6,-1);

--  作者:tanyongde
--  发布时间:2016/11/10 11:01:49
--  
改后回测结果不一样,?谢!!
--  作者:jinzhe
--  发布时间:2016/11/10 11:18:27
--  

你没写对,你前面写的是错的。我修改的是正确的写法,