以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请问隔日开仓,怎么表达 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=75141) |
-- 作者:IF左边 -- 发布时间:2015/1/29 12:21:34 -- 请问隔日开仓,怎么表达 比如今天开仓有利持有的情况下,隔日再开第二笔。 |
-- 作者:IF左边 -- 发布时间:2015/1/29 12:49:24 -- 当天开仓一笔有利,就不开第二笔了,如果当天第一笔止损,就还开第二笔。 |
-- 作者:IF左边 -- 发布时间:2015/1/29 12:58:36 -- variable:n=0; variable:m=0; if date<>ref(date,1) then n:=0; if duo and n<=1 and m=0 and h>=cpj+qatr/3 and (holding=0 or holding=1*ENTERVOL) and time<145500 then begin sellshort(1,0,market); buy(1,1,market); n:=n+1; m:=1; end s:=ref(qatr,enterbars); if L<=ENTERPRICE-s/3 and enterbars>0 then begin sell(1,entervol,market); m:=0; end if hhv(h,enterbars+1)>=ENTERPRICE+s/3 and l<=ENTERPRICE and enterbars>0 then begin sell(1,entervol,market); m:=0; end if time>=150000 then begin n:=0; m:=0; end 这样写,第一笔有利的情况下,为什么还会开第二笔,请帮我看一下哪里写错了? |
-- 作者:IF左边 -- 发布时间:2015/1/29 13:01:41 -- 我的思路是日内交易限制两次,有利的交易限制一次。第一笔止损或保本,可以开第二笔,第一笔有利,日内就不可以开第二笔了。 |
-- 作者:jinzhe -- 发布时间:2015/1/29 13:28:15 -- 你把类似的 enterprice+s/3的,都给括号括起来 |
-- 作者:IF左边 -- 发布时间:2015/1/29 14:25:34 -- 括起来,还是一样的,有利之后,还是要开第二笔, |
-- 作者:jinzhe -- 发布时间:2015/1/29 14:29:09 -- 那么还是那句话,把全部的代码都贴出来 |
-- 作者:IF左边 -- 发布时间:2015/1/29 14:37:03 -- variable:n=0; variable:m=0; if date<>ref(date,1) then n:=0; if duo and n<=1 and m=0 and h>=(cpj+qatr/3) and (holding=0 or holding=1*ENTERVOL) and time<145500 then begin sellshort(1,0,market); buy(1,1,market); n:=n+1; m:=1; end s:=ref(qatr,enterbars); if L<=(ENTERPRICE-s/3) and enterbars>0 then begin sell(1,entervol,market); m:=0; end if hhv(h,enterbars+1)>=(ENTERPRICE+s/3) and l<=ENTERPRICE and enterbars>0 then begin sell(1,entervol,market); m:=0; end if kong and n<=1 and m=0 and l<=(cpj-qatr/3) and (holding=0 or holding=-1*ENTERVOL) and time<145500 then begin sell(1,0,market); buyshort(1,1,market); n:=n+1; m:=1; end s:=ref(qatr,enterbars); if h>=(ENTERPRICE+s/3) and enterbars>0 then begin sellshort(1,entervol,market); m:=0; end if llv(h,enterbars+1)<=(ENTERPRICE-s/3) and h>=ENTERPRICE and enterbars>0 then begin sellshort(1,entervol,market); m:=0; end if time>=150000 then begin n:=0; m:=0; end |
-- 作者:jinzhe -- 发布时间:2015/1/29 14:45:04 --
这个是不是能够继续开仓的平仓止损?
把这些类似的都加一个持仓判断在外面,写成这样 if L<=(ENTERPRICE-s/3) and enterbars>0 and holding>0 then begin
空头是<0 |
-- 作者:IF左边 -- 发布时间:2015/1/29 14:54:47 -- 这样写,有利是只开一次仓了 |