Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:交易次数代码无效,求点拨

1楼
cssfortune 发表于:2014/8/12 17:17:08

//想要达到的功能是,每天只能开仓一次,平仓则不限制,可以隔夜持仓

//测试发现0812这一天,还是开仓了2次。不知道哪里出问题了??

 

variable:buysign=1; {为1时可以开仓,为0时不可以}


if enterbars=1 then buysign:=0;

 

if  buysign=1 AND holding=0 then
begin
 if buycond then
 begin
  开多1:buy(1,1,limitr,buyprice);
 end
 else if buyshortcond then
 begin
 开空1:buyshort(1,1,limitr,buyshortprice);
 end
end
 
if enterbars>=1 and holding<>0 then
 begin
 平多1:sell(holding>0 and sellcond,holding,limitr,sellprice);
 平空1:sellshort(holding<0 and sellshortcond,holding,limitr,sellshortprice);
 end
 
if closetime(0) then sellsgin:=1; {每天收盘时复原一次,以便下一天可以再开仓}

2楼
jinzhe 发表于:2014/8/12 17:24:23
if enterbars=1 then buysign:=0;这句写在开仓语句后面
[此贴子已经被作者于2014/8/12 17:25:02编辑过]
共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.17969 s, 3 queries.