创丰1号策略(代码公开)[金字塔模型]
-
相关简介:abb:=not(islastbar) or (islastbar and tholding2=0); ma1:ma(c,5); ma2:ma(c,10); ma3:ma(c,20); ma4:ma(c,60); 创丰1号-A:VALUEWHEN(TIME=0916,O),COLORMAGENTA; DIFF := EMA(CLOSE,12) - EMA(CLOSE,26); DEA := EMA(DIFF,9); MACD1 := 2*(DIFF-DEA), COLORSTICK; VARIA
abb:=not(islastbar) or (islastbar and tholding2=0);
ma1:ma(c,5);
ma2:ma(c,10);
ma3:ma(c,20);
ma4:ma(c,60);
创丰1号-A:VALUEWHEN(TIME=0916,O),COLORMAGENTA;
DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);
DEA := EMA(DIFF,9);
MACD1 := 2*(DIFF-DEA), COLORSTICK;
VARIABLE: aspect=0;
VARIABLE: stopprice=0;
VARIABLE: stopnum = 1.6;
RUNMODE:0;
if barpos = 0 then
stopprice := l - stopnum;
if aspect = 0 then
begin
if l <= stopprice then
begin
aspect:= 1;
stopprice := h+stopnum;
end
if l - stopnum > stopprice then
stopprice := l-stopnum;
end
if aspect = 1 then
begin
if h >= stopprice then
begin
aspect:= 0;
stopprice := l-stopnum;
end
if h + stopnum < stopprice then
stopprice := h+stopnum;
end
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
手数:=1;
a1:=k>ref(k,1) and c-ENTERPRICE>=9 ;
a2:=k<ref(k,1) and c-ENTERPRICE<=-9 ;
EMA13:=EMA(C,10),COLORWHITE;
EMA21:=EMA(C,21),COLORYELLOW;
EMA34:=EMA(C,34),COLORFF00FF;
EMA60:=MA(C,55),COLORFFCC66;
X1:=(C+L+H)/3;
X2:=EMA(X1,5);
X3:=EMA(X2,4);
STICKLINE(C>stopprice,LOW,HIGH,0.1,1),COLORRED;
STICKLINE(C>stopprice,CLOSE,OPEN,3,1),COLORRED;
STICKLINE(C<stopprice,LOW,HIGH,0.1,1),COLORFFFF52;
STICKLINE(C<stopprice,CLOSE,OPEN,3,0),COLORFFFF52;
BUY1:=(K>REF(K,1)&&D<REF(D,1)&&J>REF(J,1))&&C>stopprice&&time>0915&&time<=1510 and macd1>ref(macd1,1) and holding<=0 ;
SELL1:=(J<REF(J,1)&&K<REF(K,1)&&D>REF(D,1))&&C<stopprice&&time>0915&&time<=1510 and macd1<ref(macd1,1) and holding>=0 ;
VARIABLE:DUOKONG=0;
TSFS:=0;
ORDVOL:=1; {开仓手数}
ZSDS:=8;
VARIABLE:YDZY=1;
VARIABLE:HIGHPRICE=0,LOWPRICE=0;
VARIABLE:DHCDS=5,KHCDS=5;
VARIABLE:DYLDS=1,KYLDS=1;
VARIABLE:Z3B1:=1;
DUOKONG:=1;
IF HOLDING<0 THEN BEGIN
IF BUY1 THEN BEGIN
空平:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
END
IF a1 THEN BEGIN
空损:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
多1开:BUY(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
END
IF YDZY=1 THEN BEGIN
IF L<LOWPRICE THEN BEGIN
LOWPRICE:=L;
END
IF ENTERPRICE-LOWPRICE>=KYLDS and c-ENTERPRICE<=-0.2 THEN BEGIN
IF L-LOWPRICE>=KHCDS THEN BEGIN
空赢:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
END
END
END
IF Z3B1=1 THEN BEGIN
IF ENTERPRICE-LOWPRICE>=3 THEN BEGIN
IF ENTERPRICE-L<=1.2 THEN BEGIN
END
END
END
END
IF HOLDING=0 THEN BEGIN
IF DUOKONG=1 OR DUOKONG=2 THEN BEGIN
IF BUY1 and abb THEN BEGIN
多开:BUY(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
HIGHPRICE:=ENTERPRICE;
END
END
END
IF HOLDING>0 THEN BEGIN
IF SELL1 THEN BEGIN
多平:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;;
END
IF a2 THEN BEGIN
多损:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;
空1开:BUYSHORT(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
END
IF YDZY=1 THEN BEGIN
IF H>HIGHPRICE THEN BEGIN
HIGHPRICE:=H;
END
IF HIGHPRICE-ENTERPRICE>=DYLDS and c-ENTERPRICE>=0.2 THEN BEGIN
IF HIGHPRICE-H>=DHCDS THEN BEGIN
多赢:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;
END
END
END
IF Z3B1=1 THEN BEGIN
IF HIGHPRICE-ENTERPRICE>=3 THEN BEGIN
IF H-ENTERPRICE<=1.2 THEN BEGIN
END
END
END
END// www.guhai.com.cn
IF HOLDING=0 THEN BEGIN
IF DUOKONG=1 OR DUOKONG=3 THEN BEGIN
IF SELL1 and abb THEN BEGIN
空开:BUYSHORT(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
LOWPRICE:=ENTERPRICE;
END
END
END // www.guhai.com.cn
IF time>=1513 THEN BEGIN
收盘平空:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
END //www.guhai.com.cn
IF time>=1513 THEN BEGIN
收盘平多:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;
END