MA4
MA5:MA(CLOSE,5),RGB(255,255,255);
MA10:MA(CLOSE,10);
DRAWCOLORLINE(MA10>REF(MA10,1),MA10,RGB(255,255,128),RGB(0,128,255)),LINETHICK2;
MA20:MA(CLOSE,20),RGB(0,255,255);
MA30:MA(CLOSE,30),RGB(255,0,255);
HJ:=IF(1,1,0);
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)) *HJ;
K2:=VALUEWHEN(K1<>0,K1)*HJ ;
G:=IFELSE(K2=1,HH2,LL2) ;
G1:=VALUEWHEN(ISLASTBAR,G) ;
W1:=K2*HJ ;
W2:=OPEN-CLOSE;
HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE) ;
LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE) ;
BAA:=1*HJ ;
MA4:=EMA(CLOSE,10)*BAA*HJ ;
HH:=HHV(HIGH,5)*BAA*HJ ;
LL:=LLV(LOW,5)*BAA ;
H1:=IFELSE(CLOSE>REF(HH,1),1,0)*BAA ;
L1:=IFELSE(CLOSE<REF(LL,1),-1,0)*BAA ;
H0:=REF(HIGH,1)*BAA ;
L0:=REF(LOW,1)*BAA ;
P7:=H1+L1*BAA ;
P8:=IFELSE(P7=0,REF(P7,1),P7)*BAA ;
P9:=IFELSE(P8=0,REF(P8,1),P8)*BAA ;
P10:=IFELSE(P9=0,REF(P9,1),P9)*BAA;
P11:=IFELSE(P10=0,REF(P10,1),P10)*BAA;
P12:=IFELSE(P11=0,REF(P11,1),P11)*BAA;
P13:=IFELSE(P12=0,REF(P12,1),P12)*BAA;
P14:=IFELSE(P13=0,REF(P13,1),P13)*BAA;
P15:=IFELSE(P14=0,REF(P14,1),P14)*BAA;
P16:=IFELSE(P15=0,REF(P15,1),P15)*BAA;
P17:=IFELSE(P16=0,REF(P16,1),P16)*BAA;
P18:=IFELSE(P17=0,REF(P17,1),P17)*BAA;
P19:=IFELSE(P18=0,REF(P18,1),P18)*BAA;
P20:=IFELSE(P19=0,REF(P19,1),P19)*BAA;
P21:=IFELSE(P20=0,REF(P20,1),P20)*BAA;
P22:=IFELSE(P21=0,REF(P21,1),P21)*BAA;
P23:=IFELSE(P22=0,REF(P22,1),P22)*BAA;
P24:=IFELSE(P23=0,REF(P23,1),P23)*BAA;
P25:=IFELSE(P24=0,REF(P24,1),P24)*BAA;
P26:=IFELSE(P25=0,REF(P25,1),P25)*BAA;
P27:=IFELSE(P26=0,REF(P26,1),P26)*BAA;
P28:=IFELSE(P27=0,REF(P27,1),P27)*BAA;
P29:=IFELSE(P28=0,REF(P28,1),P28)*BAA;
P30:=IFELSE(P29=0,REF(P29,1),P29)*BAA ;
T:=IFELSE(P30=0,REF(P30,1),P30)*BAA ;
DD:=BARSLAST(CROSS(T=1,0.5))*HJ ;
KK:=BARSLAST(CROSS(T=-1,0.5))*HJ ;
N1:=7*HJ;
N2:=14*HJ;
LC := REF(CLOSE,1)*HJ;//前一周期收盘价
RSI1:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;//
RSI2:=SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100;//
SHORT:=12;
LONG:=26;
M:=9;
DIFF :=EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);//短周期与长周期的收盘价的指数平滑移动平均值做差。
DEA :=EMA(DIFF,M);
V1:=LLV(LOW,10);
V2:=HHV(H,25);
价位线:=EMA((C-V1)/(V2-V1)*4,4);
//DRAWTEXT(CROSS(3.5,价位线),90,'高●'),COLORFFFFFF;
VV1:=(C*2+H+L)/4*10;
VV2:=EMA(VV1,13)-EMA(VV1,34);
VV3:=EMA(VV2,5);
VV4:=2*(VV2-VV3)*5.5;
主力撤:=IF(VV4<=0,VV4,0);
主力进:=IF(VV4>=0,VV4,0);
V11:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
趋势线:=EMA(V11,3);
V12:=(趋势线-REF(趋势线,1))/REF(趋势线,1)*100;
买入:=趋势线<=13 AND V12>13;
BB:= (趋势线<=13 AND V12>13) AND FILTER((趋势线<=13 AND V12>13),10) ;
逃顶:=FILTER(趋势线>90 AND 趋势线<REF(趋势线,1) AND 主力进<REF(主力进,1),8);
KD1:=CROSS(T=1,0.5) AND W1=-3 AND DD<KK;
KD2:=(W1=-3 AND DD<KK AND DIFF>DEA AND RSI1>RSI2);
PK1:=CROSS(T=-1,0.5) AND W1=1 AND KK<DD;
PK2:=W1=1 AND KK<DD AND DIFF<DEA AND RSI1<RSI2;
KDD:=BARSLAST(CROSS(W1=-3 AND DD<KK,0.5))+1;
PKK:=BARSLAST(CROSS(W1=1 AND KK<DD,0.5))+1;
DD11:=(CROSS(COUNT(KD1 OR KD2,KDD)=1,0.5) OR KD1);
T1:=CROSS(3.5,价位线) AND (DIFF<DEA OR RSI1<RSI2);
T2:=逃顶 AND (DIFF<DEA OR RSI1<RSI2);
T3:=NOT( W1=-3 AND DD<KK) AND REF(W1=-3 AND DD<KK,1);
T31:=CROSS(DIFF<DEA AND RSI1<RSI2,0.5);
T4:=CROSS(COUNT(T1 OR T2 OR T3 OR T31,BARSLAST(DD11)+1)=1 ,0.5);
KK11:=(CROSS(COUNT(PK1 OR PK2,PKK)=1,0.5) OR PK1);
S1:=CROSS(价位线,0.3) AND (DIFF>DEA OR RSI1>RSI2);
S2:=BB AND (DIFF>DEA OR RSI1>RSI2);
S3:=NOT( W1=1 AND DD>KK) AND REF(W1=1 AND DD>KK,1);
S31:=CROSS(DIFF>DEA AND RSI1>RSI2,0.5);
S4:=CROSS(COUNT(S1 OR S2 OR S3 OR S31,BARSLAST(KK11)+1)=1 ,0.5);
M1:=MA(CLOSE,5);
M2:=MA(CLOSE,20),COLORYELLOW;
ZYZS:=IFELSE((M1 > M2),M2,M1)*HJ ;
PARTLINE1( (W1=1 AND KK<DD)*HJ , MA20), COLORCYAN,LINETHICK2;
PARTLINE1( (W1=-3 AND DD<KK )*HJ , MA20), COLORRED,LINETHICK2;
D10151:=BARSLAST((CROSS(COUNT(KD1 OR KD2,KDD)=1,0.5) OR KD2) AND C>MA20) ;
K10152:=BARSLAST((CROSS(COUNT(PK1 OR PK2,PKK)=1,0.5) OR PK2) AND C<MA20);
K10152P:=BARSLAST(NOT(W1=1 AND KK<DD));
D10151P:=BARSLAST(NOT(W1=-3 AND DD<KK));
PJ:=MA(H-L,20);
DRAWTEXT(CROSS(D10151<D10151P,0.5)*HJ,L-PJ,'波段多▲'),VALIGN0,COLORRED;
DRAWTEXT(CROSS(D10151>D10151P,0.5)*HJ,H,'平多'),VALIGN2,COLORGREEN;
DRAWTEXT(CROSS(K10152>K10152P,0.5)*HJ,L,'平空'),VALIGN0,COLORMAGENTA;
DRAWTEXT(CROSS(K10152<K10152P,0.5)*HJ,H+PJ,'波段空▼'),VALIGN2,RGB(255,255,0);
DRAWKLINE1(H,O,L,C);
A1:=C>REF(C,4);
NT:=BARSLASTCOUNT(A1);
TJ11:=9;
TJ13:=ISLASTBAR AND BETWEEN(NT,5,8);
AY:=(BACKSET(TJ11>0,9) OR BACKSET(TJ13>0,NT))*NT;
MM:=BACKSET(NT=9,9);
DRAWNUMBER(MM=1&&AY>0,H,NT,0,COLORYELLOW);
NX:=BACKSET(ISLASTBAR,NT);
DRAWNUMBER(NX&&REFX1(NT<9,100),H,NT,0,COLORYELLOW);
DRAWICON(NT=9,H+2,'ICO9'),COLORGREEN;
B1:=C<REF(C,4);
NT0:=BARSLASTCOUNT(B1);
TJ21:=NT0=9 ;
NN:=BACKSET(NT0=9,9);
TJ23:=ISLASTBAR AND BETWEEN(NT0,5,8);
AY1:=(BACKSET(TJ21>0,9) OR BACKSET(TJ23>0,NT0))*NT0;
DRAWNUMBER(NN=1&&AY1>0,L,NT0,0,COLORFF00FF),VALIGN0;
ND:=BACKSET(ISLASTBAR,NT0);
DRAWNUMBER(ND&&REFX1(NT0<9,100),L,NT0,0,COLORFF00FF),VALIGN0;
DRAWICON(NT0=9,L-2,'ICO112'),COLORGREEN;
1HH:=HHV(HIGH,3);
1LL:=LLV(LOW,3);
1HH1:=BARSLAST((1HH > REF(1HH,1)));
1LL1:=BARSLAST((1LL < REF(1LL,1)));
DRAWTEXT(CROSS(1HH1,LL1),1HH,'↓'),RGB(255,255,128),VALIGN2,FONTSIZE30;
DRAWTEXT(CROSS(1LL1,1HH1),LL,'↑'),RGB(255,255,0),VALIGN0,FONTSIZE30;
EMA3:=EMA(C,3);
MA8:=EMA(EMA3,8),COLORYELLOW,LINETHICK1;
AA10:=EMA(EMA3,8),COLORYELLOW,LINETHICK1;
BB10:=ATAN((AA10-REF(AA10,1)))*180/3.1416;