以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]怎么控制开仓次数?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=137367)

--  作者:xyy13qq
--  发布时间:2016/8/1 16:48:18
--  [求助]怎么控制开仓次数?
举例:
开仓条件成立为kdj 金叉  并且持仓数<3,买入1手;  怎么编写?
构想1:

kd:=k>d 

BUY(KD AND HOLDING<3,1,THISCLOSE);

构想2:

kd:=k>d and  holding<3 ;

BUY(KD AND HOLDING<3,1,THISCLOSE);

请问这两个有没有对的? 请高手 回复正确的写法?

--  作者:jinzhe
--  发布时间:2016/8/1 16:51:16
--  

buy(cross(k,d) and holding<3 ,1,thisclose);

这样写


--  作者:xyy13qq
--  发布时间:2016/8/1 17:25:13
--  
老师:
如果是空单要不要给holding 求绝对值 ?
buyshort (cross(d,k) and holding<3 ,1,thisclose);
buyshort (cross(d,k) and abs(holding)<3 ,1,thisclose);






--  作者:jinzhe
--  发布时间:2016/8/1 17:26:31
--  

是的

或者holding>-3

[此贴子已经被作者于2016-8-1 17:26:45编辑过]

--  作者:xyy13qq
--  发布时间:2016/8/1 17:33:43
--  
谢谢!

我想测试日内交易 ,历史检测策略时发现 收益率超高。怎么过滤呢? 我的想法是加上收盘前清仓,怎么写?    下面代码怎么修改,还要加上晚盘时间.

//收盘前清仓

entertime:=time>=092500 and time<=145500; 
 exittime:=time>=150000; 
 

 if  holding >0 and exittime then begin 
 sell(1,holding,limitr,close); 
 end 
 
 if  holding <0 and exittime then begin 
 sellshort(1,holding,limitr,close); 
 end 

--  作者:xyy13qq
--  发布时间:2016/8/1 17:35:21
--  
金字塔显示的时间是处理过的,这个代码可以用吗?   本人现在行情还是金字塔的时间。
--  作者:jinzhe
--  发布时间:2016/8/2 8:41:02
--  
收盘清仓时间这样写:time>=closetime(0)