以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 平仓信号出现白箭头 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=142813) |
-- 作者:tanyongde -- 发布时间:2016/11/16 9:31:28 -- 平仓信号出现白箭头 平仓信号出现白箭头,是什么原因? 平仓逻辑清晰:1,持仓enterbars>1 ,持仓周期大于3周期收盘价平仓; 2,止盈h>=enterprice+p2/1000*enterprice l>=enterprice-p2/1000*enterprice 最高价或最低价达到指定价平仓 3,止损l<=enterprice-p1/1000*enterprice h>=enterprice+p1/1000*enterprice 最低价或最高价达到指定价平仓 if holding>0 then begin if enterbars>1 then begin sell(1,holding,limitr,close); //sell(1,holding,marketr); myexitprice:=0; end if h>=enterprice+p2/1000*enterprice then begin myexitprice:=enterprice+p2/1000*enterprice; //sell(1,holding,marketr); sell(1,holding,limitr,myexitprice); myexitprice:=0; end if l<=enterprice-p1/1000*enterprice then begin myexitprice:=enterprice-p1/1000*enterprice; //sell(1,holding,marketr); sell(1,holding,limitr,myexitprice); myexitprice:=0; end end //盈亏计算 if holding<0 then begin if enterbars>1 then begin sellshort(1,holding,limitr,close); //sellshort(1,holding,marketr); myexitprice:=0; end if l>=enterprice-p2/1000*enterprice then begin myexitprice:=enterprice-p2/1000*enterprice; //sellshort(1,holding,marketr); sellshort(1,holding,limitr,myexitprice); myexitprice:=0; end if h>=enterprice+p1/1000*enterprice then begin myexitprice:=enterprice+p1/1000*enterprice; //sellshort(1,holding,marketr); sellshort(1,holding,limitr,myexitprice); myexitprice:=0; end end
|
-- 作者:jinzhe -- 发布时间:2016/11/16 9:36:17 -- 平仓有白色箭头说明平仓时的价格超过了k线范围,不易成交 用IGNORECHECKPRICE来处理,使用方法看函数说明 |
-- 作者:风度翩翩 -- 发布时间:2016/11/16 10:30:25 -- 楼主 跳空 导致 价格 不在你想的价格,成交不了啊,要考虑实际些 跳空 |
-- 作者:tanyongde -- 发布时间:2016/11/16 11:09:02 -- 1,很奇怪回测多头没有白箭头,只有空头止盈才会有!!! 2,止盈指令没有用,不管参数多少结果一样 3,止盈编写有问题?
|
-- 作者:jinzhe -- 发布时间:2016/11/16 11:31:22 -- 以下是引用jinzhe在2016-11-16 9:36:17的发言:
平仓有白色箭头说明平仓时的价格超过了k线范围,不易成交 用IGNORECHECKPRICE来处理,使用方法看函数说明 首先白色箭头的机制是这样的。 然后就回去检查下为什么空价格却超过了k线范围 l>=enterprice-p2/1000*enterprice h>=enterprice+p1/1000*enterprice
平空条件是这两个,其中第一个,除非L恰好等于enterprice-p2/1000*enterprice ,不然enterprice-p2/1000*enterprice 的价格必然是比L低的,所以,白色箭头这个不合理的价格出现的 所以这一段这样改: if l>=enterprice-p2/1000*enterprice then begin myexitprice:=enterprice-p2/1000*enterprice;
//sellshort(1,holding,marketr);
sellshort(1,holding,limitr,L);
myexitprice:=0;
end
|