以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请帮忙看看为什么在走完K线的情况下还会有信号闪烁的情况 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=10182) |
-- 作者:大灰狼 -- 发布时间:2012/2/16 19:30:10 -- 请帮忙看看为什么在走完K线的情况下还会有信号闪烁的情况 variable:zs=c,hl=c; hi20:=ref(hhv(h,20),1); lo20:=ref(llv(l,20),1); if holding>0 and l<zs then sell(1,1,limitr,min(o,zs)-mindiff);//止损 if holding<0 and h>zs then sellshort(1,1,limitr,max(o,zs)+mindiff);//止损 if holding>0 and l<lo20 then sell(1,1,limitr,min(o,lo20)-mindiff);//离场 if holding<0 and h>hi20 then sellshort(1,1,limitr,max(o,hi20)+mindiff);//离场 if holding=0 and h>hi20 then begin//开多 buy(1,1,limitr,max(o,hi20)+mindiff); hl:=h;//记录开仓后的最高点 zs:=enterprice-50*mindiff;//初始止损50个跳动点 end if holding=0 and l<lo20 then begin//开空 buyshort(1,1,limitr,min(o,lo20)-mindiff); hl:=l;//记录开仓后的最低点 zs:=enterprice+50*mindiff;//初始止损50个跳动点 end if holding>0 and h>hl then begin//上移最高点 hl:=h; if hl>enterprice+80*mindiff then zs:=hl-20*mindiff;//满80个点,回落20点为止损位 else if hl>enterprice+50*mindiff then zs:=hl-30*mindiff;//满50个点,回落30点为止损位 end if holding<0 and l<hl then begin hl:=l; if hl<enterprice-80*mindiff then zs:=hl+20*mindiff;//满80个点,反弹20点为止损位 else if hl<enterprice-50*mindiff then zs:=hl+30*mindiff;//满50个点,反弹30点为止损位 end |
-- 作者:阿火 -- 发布时间:2012/2/16 20:20:23 -- 呵呵,这是我的风格啊 结构清晰,赏心悦目
该方法是运用在固定轮询或者高频的。 (K线走完,信号不会闪烁。但下单是按指定价下单,可能过大或者过小) 此外有几个问题,跟楼主探讨一下: 1,离场问题。比如多平, zs 和 lo20 谁先触碰到,要有个判断。如果是先触碰到lo20,却用zs评测,不科学。 2,开多条件和开空条件可能会同时成立,要稍微处理一下 3,别用enterprice, 用全局变量自己记录,速度更快 4,加1个mindiff,太小了。至少要3个才合理啊(评测要求) 5,开仓当根可能就达到50个点的利润。所以,开多时要用“h>=hl ” 完整如下: variable:zs=0,hl=0,kcj=0; if holding=0 and h>hi20 and ref(c,1)>ref(c,20) then begin//开多
[此贴子已经被作者于2012-2-16 20:24:16编辑过]
|