以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (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=182941) |
-- 作者:代人发贴 -- 发布时间:2020/11/10 15:03:15 -- 以下金字塔波段王双向开仓策略源码更改为只开多单,只开空单两个策略,谢谢 以下金字塔波段王双向开仓策略源码更改为只开多单,只开空单两个策略,谢谢
HH1:=IFELSE(H<REF(H,1)&&REF(H,1)<REF(H,2),REF(H,2),0); LL1:=IFELSE(L>REF(L,1)&&REF(L,1)>REF(L,2),REF(L,2),0); HH2:=VALUEWHEN(HH1>0,HH1); LL2:=VALUEWHEN(LL1>0,LL1); K1:=IFELSE(CLOSE>HH2,-3,IFELSE(CLOSE<LL2,1,0)); K2:=VALUEWHEN(K1<>0,K1); G:=IFELSE(K2=1,HH2,LL2); G1:=VALUEWHEN(ISLASTBAR,G); DRAWNUMBER(L>0,G1,G1,0,COLORCYAN); W1:=K2; W2:=OPEN-CLOSE; HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE); LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE); CROSS(C,G),BPK; CROSS(G,C),SPK; |
-- 作者:FireScript -- 发布时间:2020/11/10 15:07:22 -- 开空策略: HH1:=IFELSE(H<REF(H,1)&&REF(H,1)<REF(H,2),REF(H,2),0); LL1:=IFELSE(L>REF(L,1)&&REF(L,1)>REF(L,2),REF(L,2),0); HH2:=VALUEWHEN(HH1>0,HH1); LL2:=VALUEWHEN(LL1>0,LL1); K1:=IFELSE(CLOSE>HH2,-3,IFELSE(CLOSE<LL2,1,0)); K2:=VALUEWHEN(K1<>0,K1); G:=IFELSE(K2=1,HH2,LL2); G1:=VALUEWHEN(ISLASTBAR,G); DRAWNUMBER(L>0,G1,G1,0,COLORCYAN); W1:=K2; W2:=OPEN-CLOSE; HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE); LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE);if CROSS(C,G) and holding<0 then sellshort(1,holding,market); if CROSS(G,C) and holding=0 then buyshort(1,holding,market);开多策略: HH1:=IFELSE(H<REF(H,1)&&REF(H,1)<REF(H,2),REF(H,2),0); LL1:=IFELSE(L>REF(L,1)&&REF(L,1)>REF(L,2),REF(L,2),0); HH2:=VALUEWHEN(HH1>0,HH1); LL2:=VALUEWHEN(LL1>0,LL1); K1:=IFELSE(CLOSE>HH2,-3,IFELSE(CLOSE<LL2,1,0)); K2:=VALUEWHEN(K1<>0,K1); G:=IFELSE(K2=1,HH2,LL2); G1:=VALUEWHEN(ISLASTBAR,G); DRAWNUMBER(L>0,G1,G1,0,COLORCYAN); W1:=K2; W2:=OPEN-CLOSE; HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE); LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE);if CROSS(G,C) and holding>0 then sell(1,holding,market); |