以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请问下面这两种写法中有没有偷价?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=75540)

--  作者:jason_shj
--  发布时间:2015/2/10 15:02:19
--  请问下面这两种写法中有没有偷价?
那么该如何修改代码呢,我的主要思路是,突破上根bar的上轨,以此价格做多,突破上根bar 的下轨,以此价格做空?

如果这样写有没有偷价呢?
upband:=ma(c,20)+2*std(c,20);
dnband:=ma(c,20)-2*std(c,20);
if holding=0 then
begin
if EntryLongCond then buy(1,1,limitr,upband);
     
 if EntryShortCond  then buyshort(1,1,limitr,dnband);
end;
和下面比较哪种可以表示我突破上下轨入场的思路呢?
upband:=ma(c,20)+2*std(c,20);
dnband:=ma(c,20)-2*std(c,20);
if holding=0 then
begin
if EntryLongCond then buy(1,1,limitr,Ref(upband,1));
     
 if EntryShortCond  then buyshort(1,1,limitr,REF(dnband,1));
end;
[此贴子已经被作者于2015/2/10 15:02:47编辑过]

--  作者:jinzhe
--  发布时间:2015/2/10 15:32:54
--  
如果觉得价格不利,推荐用market进行市价下单