以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 满足条件,系统为何不开仓? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=144821) |
-- 作者:daviwang -- 发布时间:2016/12/15 16:51:45 -- 满足条件,系统为何不开仓? 开仓语句: if holding=0 and cys>0 then BEGIN; sell(开空条件3 and a1,1,MARKET); end; 在某一时刻下,holding=0 and cys>0 ,开空条件3=1 and a1=1,但系统并未开仓,是什么原因呢?
|
-- 作者:daviwang -- 发布时间:2016/12/15 17:11:49 -- 全部代码如下: input:m1(10,1,100,2),n(1.2,0.1,20,1),n1(2,0.1,20,1),m(9,1,20,1),s(13,1,20,1),p(26,1,30,1),n2(3,1,20,1),n3(5,1,20,1),n4(7,0.1,20,1); BBI:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4; UPR:=BBI+N*ema(tr,M1); DWN:=BBI-N*ema(tr,M1); c1:=ref(c,1); DIFF := EMA(CLOSE,S) - EMA(CLOSE,P); DEA := EMA(DIFF,M); MACD1 := 2*(DIFF-DEA); macd2:=ref(macd1,1); hhv1hh:=STKINDI(\'\',\'wwma.hhv1h\',0,5); llv1hh:=STKINDI(\'\',\'wwma.llv1h\',0,5); h1:=hour; h2:=ref(hour,30); 平空条件:=h1=h2; if holding<>0 then BEGIN; SELLSHORT(平空条件,0,MARKET); end; max0:=ma(c,n2); max1:=ref(ma(c,n2),1); mad0:=ma(c,n3); mad1:=ref(ma(c,n3),1); cys:=count(cross(ma(c,n2),ma(c,n3)) or cross(ma(c,n3),ma(c,n2)),n4); 开空条件1:=macd1<ref(macd1,1) and ref(macd1,1)<ref(macd1,2) and ref(macd1,2)<ref(macd1,3); 开空条件2:=C>BBI; 开空条件3:=C>BBI; a1:=macd1<macd2; if holding=0 and max0>mad0 and cys=0 then begin; sell(开空条件1,1,MARKET); end; if holding=0 and max0<mad0 and cys=0 then begin; sell(开空条件2 and a1,1,MARKET); end; if holding=0 and cys>0 then BEGIN; sell(开空条件3 and a1,1,MARKET); end; 持仓:=holding; |
-- 作者:yukizzc -- 发布时间:2016/12/15 17:21:27 -- 这个要具体看交易日志了,是条件触发了没开仓,还是条件没有触发。 还有信号是稳定满足的,还是盘中某一个时刻才满足而程序检测间隔没有检测到呢 另外程序运行模式是走完k是固定时间间隔的?
|
-- 作者:daviwang -- 发布时间:2016/12/15 17:33:04 -- 找到原因了,用了平空的语句sell,应该用开空的语句BUYSHORT ...... |