以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 平仓反手不在同一K? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=153053) |
-- 作者:系统使用者 -- 发布时间:2017/5/16 14:10:43 -- 平仓反手不在同一K? if ref((tmpd=1 or (count(bi=-1,2)=1 and aq1>=1)) and (gpd1 or gpd2),1) then begin sellshort(1,ss,LIMITR,O); buy(holding=0,ss,LIMITR,O); end 多止:valuewhen(enterbars=1,llv(fl,2)),NODRAW; if enterbars>1 and min(o,c)<=多止-2*MINDIFF then sell(1,ss,marketr); if holding>0 and ((enterbars>1 and pdd=-1) or (enterbars>15 and aspect=1)) then sell(1,ss,marketr); if ref((tmpk=-1 or (count(bi=1,2)=1 and aq1>=1)) and (gpk1 or gpk2),1) then begin sell(1,ss,LIMITR,O); buyshort(holding=0,ss,LIMITR,O); end 空止:valuewhen(enterbars=1,hhv(fh,2)),NODRAW; if enterbars>1 and max(o,c)>=空止+2*MINDIFF then sellshort(1,ss,marketr); if holding<0 and ((enterbars>1 and pkk=1) or (enterbars>15 and aspect=0)) then sellshort(1,ss,marketr); 请帮忙看看
|
-- 作者:wenarm -- 发布时间:2017/5/16 14:36:58 -- 具体说明下你的问题 |
-- 作者:系统使用者 -- 发布时间:2017/5/16 16:59:55 -- 反手的,平与开不在同一个K上 [此贴子已经被作者于2017/5/16 17:01:44编辑过]
|
-- 作者:系统使用者 -- 发布时间:2017/5/16 17:07:35 -- 平仓在前一K线,开仓在次K上 。上面语言哪里出问题? |
-- 作者:wenarm -- 发布时间:2017/5/16 17:19:37 -- if ref((tmpd=1 or (count(bi=-1,2)=1 and aq1>=1)) and (gpd1 or gpd2),1) then begin
sellshort(1,ss,LIMITR,O);
buy(holding=0,ss,LIMITR,O);
end
平仓反手在图表中,是同时进行的,也就是说在执行sellshort和buy是使用的同一个holding的状态值,所以在平仓后就会造成buy(holding=0,...)条件不满足,。也就是你看到的现象
你可以改成
sellshort(1,holding,LIMITR,O);
buy(1,ss,LIMITR,O); |
-- 作者:系统使用者 -- 发布时间:2017/5/17 11:53:17 -- sellshort(1,holding,LIMITR,O); buy(1,ss,LIMITR,O); 这样会出现连续开多
|
-- 作者:pyd -- 发布时间:2017/5/17 12:06:44 -- 加上holding=0 buy(1 and holding=0,ss,LIMITR,O); |
-- 作者:wenarm -- 发布时间:2017/5/17 12:24:36 -- 抱歉前面5楼的解释不对,把实际下单的状态和图表混了。你贴出的完整的平仓反手条件。 sellshort(1,holding,LIMITR,O); buy(holding=0,ss,LIMITR,O);
或者在
if ref((tmpd=1 or (count(bi=-1,2)=1 and aq1>=1)) and (gpd1 or gpd2),1) and holding<=0 then begin
|