以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  在达到条C时平仓此后不再开仓,怎么写?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=72334)

--  作者:qq代人发帖
--  发布时间:2014/11/25 9:13:29
--  在达到条C时平仓此后不再开仓,怎么写?
请教:在达到条C时平仓此后不再开仓,怎么写?
--  作者:pyd
--  发布时间:2014/11/25 9:17:07
--  
VARIABLE:n=0;
if 开仓条件 and n=0 then buy(holding=0,1,market);
if 条件c then begin
sell(holding>0,holding,market);
n:=1;
end

--  作者:向日葵
--  发布时间:2014/11/25 9:34:24
--  
谢谢
--  作者:向日葵
--  发布时间:2014/11/25 9:50:12
--  
老师,我用上面的方法测试了,13:45分平多仓即空仓后,14点多,仍然还能开仓,这怎么办啊?
--  作者:pyd
--  发布时间:2014/11/25 9:52:22
--  

你说的不再开仓是当天不再开仓吗?

[此贴子已经被作者于2014/11/25 9:53:01编辑过]

--  作者:向日葵
--  发布时间:2014/11/25 9:52:54
--  
我的意思是:这样平仓后,在此后N周期内就不再开仓了,或日内就不再开仓了。请指导
--  作者:pyd
--  发布时间:2014/11/25 9:55:43
--  

平仓后当然不再开仓

VARIABLE:n=0,m=0;
if 开多条件 and n=0 then buy(holding=0,1,market);
if 平多条件 then begin
sell(holding>0,holding,market);
n:=1;
end 
if 开空条件 and m=0 then buyshort(holding=0,1,market);
if 平空条件 then begin
 sellshort(holding<0,holding,market);
 m:=1;
 end

if time=CLOSETIME(0) then BEGIN
n:=0;
m:=0;
end

[此贴子已经被作者于2014/11/25 9:59:58编辑过]

--  作者:向日葵
--  发布时间:2014/11/25 10:16:58
--  

/平仓后当然不再开仓

VARIABLE:n1=0,m11=0;
if 开多条件 and n1=0 then buy(holding=0,1,market);
if PD4 then begin
sell(holding>0,holding,market);
n1:=1;
end 
if 开空条件 and m11=0 then buyshort(holding=0,1,market);
if PK4 then begin
 sellshort(holding<0,holding,market);
 m11:=1;
 end

if time=CLOSETIME(0) then BEGIN
n1:=0;
m11:=0;
end

 

其中:PD4为另外的平多条件,PK4为另外的平空条件。n,m因为重复,改为n1,m11.

这样变动一下可以吗?老师

 


--  作者:pyd
--  发布时间:2014/11/25 10:25:11
--  
可以,是平仓后当天不再开仓不是当然,笔误。
--  作者:向日葵
--  发布时间:2014/11/25 10:42:03
--  

还不行啊老师,还是13:45分平多仓即空仓后,14点多,仍然还能开仓,这怎么办啊?