以文本方式查看主题

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

--  作者:海沙
--  发布时间:2014/8/22 10:48:52
--  关于CALLSTOCK
我的策略是在指数上运行的操作对象是主力合约,限价下单。使用函数CALLSTOCK("IF00",VTCLOSE)后,没有信号了,去掉这句后策略运行正常。为什么
[此贴子已经被作者于2014/8/22 10:49:32编辑过]

--  作者:jinzhe
--  发布时间:2014/8/22 10:49:25
--  

if00用单引号不是双引号


--  作者:海沙
--  发布时间:2014/8/22 10:51:30
--  
换成单引号后还是不行
--  作者:海沙
--  发布时间:2014/8/22 10:55:42
--  
换成单引号后还是不行,用SHIFT+Q查了一下,得不到最新价格。代码是这样:myenterprice:=callstock(\'if00\',vtclose);查出来后如截图。
图片点击可在新窗口打开查看此主题相关图片如下:7.jpg
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2014/8/22 11:00:47
--  
改完代码后保存一下,
--  作者:海沙
--  发布时间:2014/8/22 11:09:02
--  

老大,我都保存好几次了。

这是我完整的代码

    if refcykg=1 and refc>pp and h>highestaftercross then
      begin
//        myenterprice:=max(highestaftercross,o);
        myenterprice:=callstock("if00",vtclose);
        if holding<0 then
          begin
            sellshort(1,holdingvol,limitr,myenterprice+hd*mindiff),ignorecheckprice,orderqueue;
            holdingvol:=0;
            buy(1,firstvol,limitr,myenterprice+hd*mindiff),ignorecheckprice,orderqueue;
            holdingvol:=holdingvol+firstvol;
            lastprice:=enterprice,noaxis; 
          end
      end

[此贴子已经被作者于2014/8/22 11:10:24编辑过]

--  作者:海沙
--  发布时间:2014/8/22 11:12:15
--  

上面代码不对。

是这个

if refcykg=1 and refc>pp and h>highestaftercross then
      begin
//        myenterprice:=max(highestaftercross,o);
        myenterprice:=callstock(\'if00\',vtclose);
        if holding<0 then
          begin
            sellshort(1,holdingvol,limitr,myenterprice+hd*mindiff),ignorecheckprice,orderqueue;
            holdingvol:=0;
            buy(1,firstvol,limitr,myenterprice+hd*mindiff),ignorecheckprice,orderqueue;
            holdingvol:=holdingvol+firstvol;
            lastprice:=enterprice,noaxis; 
          end
      end
     


--  作者:jinzhe
--  发布时间:2014/8/22 11:18:39
--  


myenterprice:=callstock(\'if00\',vtclose);
你直接写这句,不要加前面那些前置的判断。看看有没数据

如果有数据,那么说明你的判断条件没满足所才导致的你上面代码里面的myenterrpcie没有数据


--  作者:海沙
--  发布时间:2014/8/22 11:23:17
--  

嘿嘿,是我没有把代码全部改过来,现在正常了。

再问一个问题,市价指令MARKET一定要等到下周期开盘吗?有没有本周期内的市价指令?意思就是说按信号出现时的市价去下单.

[此贴子已经被作者于2014/8/22 11:24:28编辑过]

--  作者:jinzhe
--  发布时间:2014/8/22 11:30:50
--  
不是,市价的意思是:实际下单按照市价下单,在测评里面才是次周期开盘价