以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 公式模型编写问题提交 (http://222.73.7.161/bbs/list.asp?boardid=4) ---- [求助]突破交易开不起仓位 (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=166389) |
-- 作者:进击的红太狼 -- 发布时间:2018/11/8 18:51:43 -- [求助]突破交易开不起仓位 如题,输出在K线图上开不起仓,帮忙看看哪里出现问题了,谢谢 input:开仓数量(1,0,100),开仓止损(5,0,1000); 创新高天数:NEWHBARS(HIGH,1); 创新低天数:NEWLBARS(LOW,1); //当前浮动盈亏:openprofit; 开多止损:=enterprice-c; 开空止损:=c-enterprice; //开仓止损*************** if 开多止损>开仓止损*mindiff and holding>0 then begin sell(1,holding,marketr);end if 开空止损>开仓止损*mindiff and holding>0 then begin sellshort(1,holding,marketr);end //突破开仓交易******************* if 创新高天数>0 and holding<0 then begin buy(1,开仓数量,marketr);end if 创新低天数>0 and holding<0 then begin buyshort(1,开仓数量,marketr);end //其他************************ 当前持仓:HOLDING,COLORGRAY,LINETHICK0,nodraw; 当前资产:ASSET,NOAXIS,COLORGRAY; 当前盈亏:OPENPROFIT; |
-- 作者:FireScript -- 发布时间:2018/11/9 9:04:35 -- 图表上的虚拟持仓不支持在持有多头时候开空,反之亦然。通常开仓时候会判断holding是不是等于0. 我修正了这块的逻辑处理。 input:开仓数量(1,0,100),开仓止损(5,0,1000); 创新高天数:=NEWHBARS(HIGH,1); 创新低天数:=NEWLBARS(LOW,1); //当前浮动盈亏:openprofit; 开多止损:enterprice-c; 开空止损:c-enterprice; //开仓止损*************** if 开多止损>开仓止损*mindiff and holding>0 then begin sell(1,holding,marketr);end if 开空止损>开仓止损*mindiff and holding<0 then begin sellshort(1,holding,marketr);end //突破开仓交易******************* if 创新高天数>0 and holding=0 then begin buy(1,开仓数量,marketr);end if 创新低天数>0 and holding=0 then begin buyshort(1,开仓数量,marketr);end //其他************************ 当前持仓:HOLDING,COLORGRAY,LINETHICK0,nodraw; 当前资产:ASSET,NOAXIS,COLORGRAY; 当前盈亏:OPENPROFIT; 即使这样信号也不多,不过这就是你自己要调整一些条件之类的了。
|