以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 怎样会出现加仓信号? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=140229) |
-- 作者:tanyongde -- 发布时间:2016/9/29 9:20:31 -- 怎样会出现加仓信号? 如下图表交易系统出现连续两次开仓信号是什么原因? if position=0 and barpos>20 and h>l then begin
//建立多头进场条件
long:=close>=zhh and zcl>upperma and kd ;
//多头进场
if long then begin
myentryprice := if(open>zhh+0.2,open+0.6 ,zhh+0.6 ) ;
if
numseqloss<3 then begin
buy( _debug,posnum,limitr,myentryprice);
jqsh:=1;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
if numseqloss>=3 and position=0 then begin
buy( _debug,2*posnum,limitr,myentryprice);
jqsh:=1;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
if numseqwin<3 and position=0 then begin
buy( _debug,posnum,limitr,myentryprice);
jqsh:=1;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
if numseqwin>=3 and position=0 then begin
buy( _debug,0.5*posnum,limitr,myentryprice);
jqsh:=0;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end end //if
|
-- 作者:jinzhe -- 发布时间:2016/9/29 9:30:39 -- 说明连续两次满足了开仓条件 |
-- 作者:tanyongde -- 发布时间:2016/9/29 10:08:56 -- 不可能同时满足两个条件:开多条件成立,累计盈利次数3次以下开仓手数为posnum; 开多条件成立,累计盈利次数3次以上开仓手数为0.5*posnum; 开多条件成立,累计亏损次数3次以下开仓手数为posnum; 开多条件成立,累计亏损次数3次以下开仓手数为2*posnum; 要满足以上条件,应如何编写?
|
-- 作者:jinzhe -- 发布时间:2016/9/29 10:18:25 -- 你调试过,是哪两个开仓语句触发的吗? |
-- 作者:tanyongde -- 发布时间:2016/9/29 10:58:01 -- 看图表有两次开仓记录,两次开仓仓位加起来超过最大开仓手数 |
-- 作者:jinzhe -- 发布时间:2016/9/29 11:03:27 -- if position=0 and barpos>20 and h>l then begin
//建立多头进场条件
long:=close>=zhh and zcl>upperma and kd ;
//多头进场
if long then begin
myentryprice := if(open>zhh+0.2,open+0.6 ,zhh+0.6 ) ;
if numseqloss<3 then begin
开多1:buy( _debug,posnum,limitr,myentryprice);
jqsh:=1;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
if numseqloss>=3 and position=0 then begin
开多2:buy( _debug,2*posnum,limitr,myentryprice);
jqsh:=1;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
if numseqwin<3 and position=0 then begin
开多3:buy( _debug,posnum,limitr,myentryprice);
jqsh:=1;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
if numseqwin>=3 and position=0 then begin
开多4:buy( _debug,0.5*posnum,limitr,myentryprice);
jqsh:=0;
position := 1 ;
turtleunits := 1 ;
n := avgtr ;
buyorderthisbar := 1;
end
end //if
加了几个调试数据。
你看一下k线图上的信号,是开多几和开多几
|
-- 作者:tanyongde -- 发布时间:2016/9/29 11:07:33 -- 我还不会加,麻烦加一下调试 |
-- 作者:jinzhe -- 发布时间:2016/9/29 11:14:09 -- 赋值上面的代码就行 |