以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  叠加再铜1小时,出现白色无效信号  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9302)

--  作者:tonybig
--  发布时间:2011/12/9 10:48:10
--  叠加再铜1小时,出现白色无效信号

runmode:0;
movavg:=wma((high+low+close)/3,20);

truerange:=max(ref(close,1),high)-min(ref(close,1),low);
upband:=movavg+ma(truerange,20);
dnband:=movavg-ma(truerange,20);
if cross(c,upband) then buy(holding=0,1,limitr,upband);
if cross(dnband,c) then buyshort(holding=0,1,limitr,dnband);

if cross(close,movavg) then sell(holding>0,holding,limitr,c);
if cross(movavg,close) then sellshort(holding<0,holding,limitr,c);

 

 

请看问题在哪里, 我加了 enterbars>=1 仍然无效

if cross(close,movavg) then sell(holding>0 and enterbars>=1,holding,limitr,c);
if cross(movavg,close) then sellshort(holding<0 and enterbars>=1,holding,limitr,c);


 


--  作者:fly
--  发布时间:2011/12/9 11:10:39
--  

委托价格的原因,upband这样的委托价是最小变动价位的整数倍吗?能成交吗?

if cross(c,upband) then buy(holding=0,1,limitr,c);//类似位置,不妨都改成C或者C+/-(n*MINFIFF);


--  作者:tonybig
--  发布时间:2011/12/9 11:31:04
--  
upband是上轨, 如果我想用上轨成交 ,有什么函数是可以修复价格为最小变动价位的整数倍的,请给个例子,谢谢
--  作者:fly
--  发布时间:2011/12/9 13:33:54
--  

关键在于取最小变动价位的整数倍,以下示例,如果有不中意的地方,可以自行修改.

 

以IF为例,如果使3152.5数值转化为0.2的整数倍

INTPART(3152.5/mindiff)*mindiff  


--  作者:tonybig
--  发布时间:2011/12/9 15:46:56
--  
有没有函数可以修改价格最小价位的整数倍?
--  作者:tonybig
--  发布时间:2011/12/9 15:54:19
--  
upband:=trimprice(movavg+ma(truerange,20)); dnband:=trimprice(movavg-ma(truerange,20)); if cross(h,ref(upband,1)) then buy(holding=0,1,limitr,upband); if cross(ref(dnband,1),l) then buyshort(holding=0,1,limitr,dnband); if cross(ref(movavg,1),l) then sell(holding>0 ,0,limitr,movavg); if cross(h,ref(movavg,1)) then sellshort(holding<0 ,0,limitr,movavg); 加入了trimprice 还是不行 ,是不是开仓和平仓条件有问题?
--  作者:fly
--  发布时间:2011/12/12 10:26:12
--  

应该是跟开平仓条件没关系.

把您的委托TYPE变为LIMIT--委托价格变为CLOSE.图上显示就是没问题的.

 

您本地多尝试一下吧.