股票公式不明白請查閱:
股票公式文件使用以及說明!
程序化交易模型源碼:
H1:=IFELSE(HIGH<REF(HIGH,2)&&REF(HIGH,1)<REF(HIGH,2)&&REF(HIGH,2)>=REF(HIGH,3)&&REF(HIGH,2)>=REF(HIGH,4)&&REF(HIGH,2)>=REF(HIGH,5)&&REF(HIGH,2)>=REF(HIGH,6), REF(HIGH,2),0);
L1:=IFELSE(LOW>REF(LOW,2)&&REF(LOW,1)>REF(LOW,2)&&REF(LOW,2)<=REF(LOW,3)&&REF(LOW,2)<=REF(LOW,4)&&REF(LOW,2)<=REF(LOW,5)&&REF(LOW,2)<=REF(LOW,6), REF(LOW,2),0);
H2:=VALUEWHEN(H1>0,H1);
L2:=VALUEWHEN(L1>0,L1);
K11:=IFELSE(H>H2,-3,IFELSE(L<L2,1,0));
K22:=VALUEWHEN(K11<>0,K11);
G:=IFELSE(K22=1,H2,L2);
G1:=VALUEWHEN(ISLASTBAR,G);
DRAWNUMBER(LOW>0,G1,G1,0,COLORCYAN);
TMP:=VALUEWHEN(K11<>0,K11);
DRAWLINE(TMP=1&&REF(TMP,1)=1,G,TMP=1&&REF(TMP,1)=1,REF(G,1),COLORCYAN);
DRAWLINE(TMP=-3&&REF(TMP,1)=-3,G,TMP=-3&&REF(TMP,1)=-3,REF(G,1),COLORRED);
DRAWSL(K22=1,G,0,1,0,COLORCYAN);
DRAWSL(K22=-3,G,0,1,0,COLORRED);
W1:=IFELSE((OPEN-CLOSE)>0,1,-3);
W2:=OPEN-CLOSE;
HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE);
LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE);
DRAWLINE(W1=1,HIGH,W1=1,HT,COLORCYAN);
DRAWLINE(W1=1,LOW,W1=1,LT,COLORCYAN);
DRAWLINE(W1=-3,HIGH,W1=-3,HT,COLORRED);
DRAWLINE(W1=-3,LOW,W1=-3,LT,COLORRED);
STICKLINE(W1>0,OPEN,CLOSE,COLORCYAN,1);
STICKLINE(W1<=0,OPEN,CLOSE,COLORRED,1);
K22=-3&&REF(NOT(K22=-3),1),BPK;
K22=1&&REF(NOT(K22=1),1),SPK;
K22=-3&&REF(K22=-3,1)&&G<>REF(G,1),BK;
K22=1&&REF(K22=1,1)&&G<>REF(G,1),SK;