以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]求助,这个如何限制只开一手  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9180)

--  作者:victior
--  发布时间:2011/11/29 21:51:13
--  [求助]求助,这个如何限制只开一手

模型如下,9:59:00这个时间开的仓位如何才能固定只开一手呢?其他时间的开仓都固定了一手,就是这个位置不行啊?

 

ss:=REFDATE(CLOSE,date,092900);
if time=095900 then
begin
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,0,market);
end
ss:=REFDATE(CLOSE,date,095900);
if time=101300 then
begin
sellshort(holding<0 and  C>=ss-17.03,0,market);
sell(holding>0 and C<=ss+17.03,0,market);
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,1,market);
end
ss:=REFDATE(CLOSE,date,101300);
if time=105900 then
begin
sellshort(holding<0 and  C>=ss-17.03,0,market);
sell(holding>0 and C<=ss+17.03,0,market);
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,1,market);
end
ss:=REFDATE(CLOSE,date,105900);
if time=112800 then
begin
sellshort(holding<0 and  C>=ss-17.03,0,market);
sell(holding>0 and C<=ss+17.03,0,market);
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,1,market);
end
ss:=REFDATE(CLOSE,date,112800);
if time=135900 then
begin
sellshort(holding<0 and  C>=ss-17.03,0,market);
sell(holding>0 and C<=ss+17.03,0,market);
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,1,market);
end
ss:=REFDATE(CLOSE,date,135900);
if time=142900 then
begin
sellshort(holding<0 and  C>=ss-17.03,0,market);
sell(holding>0 and C<=ss+17.03,0,market);
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,1,market);
end

if time=145800 then
begin
sellshort(holding<0 ,0,market);
sell(holding>0 ,0,market);
end


--  作者:阿火
--  发布时间:2011/11/29 21:59:23
--  

奇怪了 仓位固定为1啊

if time=095900 then
begin
buy(holding=0 and C<=ss+17.03,1,market);
buyshort(holding=0 and C>=ss-17.03,1,market);
end


--  作者:victior
--  发布时间:2011/11/29 22:03:06
--  

图片点击可在新窗口打开查看

 

 

如图,9:59开的仓位是6手啊?怎样改为只开一手?


--  作者:victior
--  发布时间:2011/11/29 22:47:19
--  
终于搞掂了,呵呵!
--  作者:lcgs005
--  发布时间:2012/11/4 21:11:17
--  
以下是引用victior在2011-11-29 22:47:19的发言:
终于搞掂了,呵呵!

怎么搞定的,具体说说吧