MA10:=MA(C,5);
MA20:=MA(C,21);
JX:=CROSS(MA10,MA20);
SX:=CROSS(MA20,MA10);
LL:=IF(REFX(JX,1),LLV(L,BARSLAST(SX)+1),DRAWNULL);
HH:=IF(REFX(SX,1),HHV(H,BARSLAST(JX)+1),DRAWNULL);
LD:=IF(MA10<MA20 AND L=REFX(LL,BARSNEXT(LL)),L,0);
HD:=IF(MA10>MA20 AND H=REFX(HH,BARSNEXT(HH)),H,0);
DRAWLINE(MA10>MA20 AND H=REFX(HH,BARSNEXT(HH)),H,MA10<MA20 AND L=REFX(LL,BARSNEXT(LL)),L,0);
DRAWLINE(MA10<MA20 AND L=REFX(LL,BARSNEXT(LL)),L,MA10>MA20 AND H=REFX(HH,BARSNEXT(HH)),H,0);
LC0:=REF(L,BARSLAST(LD));
LC1:=IF(SUM(LD>0,0)>=2,REF(LC0,BARSLAST(LD)+1),0);
LC2:=IF(SUM(LD>0,0)>=3,REF(LC1,BARSLAST(LD)+1),0);
LC3:=IF(SUM(LD>0,0)>=4,REF(LC2,BARSLAST(LD)+1),0);
LC4:=IF(SUM(LD>0,0)>=5,REF(LC3,BARSLAST(LD)+1),0);
LC5:=IF(SUM(LD>0,0)>=6,REF(LC4,BARSLAST(LD)+1),0);
LC6:=IF(SUM(LD>0,0)>=7,REF(LC5,BARSLAST(LD)+1),0);
LC7:=IF(SUM(LD>0,0)>=8,REF(LC6,BARSLAST(LD)+1),0);
LC8:=IF(SUM(LD>0,0)>=9,REF(LC7,BARSLAST(LD)+1),0);
HC0:=REF(H,BARSLAST(HD));
HC1:=IF(SUM(HD>0,0)>=2,REF(HC0,BARSLAST(HD)+1),0);
HC2:=IF(SUM(HD>0,0)>=3,REF(HC1,BARSLAST(HD)+1),0);
HC3:=IF(SUM(HD>0,0)>=4,REF(HC2,BARSLAST(HD)+1),0);
HC4:=IF(SUM(HD>0,0)>=5,REF(HC3,BARSLAST(HD)+1),0);
HC5:=IF(SUM(HD>0,0)>=6,REF(HC4,BARSLAST(HD)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(LC1,MAX(LC2,LC3))) AND ZG3!=9999,HC4,9999),NODRAW;
ZG5:=IF(HC5-ZD>0 AND HC5>MAX(LC0,MAX(LC1,MAX(LC2,MAX(LC3,LC4)))) AND ZG4!=9999,HC5,9999),NODRAW;
ZG6:=IF(HC6-ZD>0 AND HC6>MAX(LC0,MAX(LC1,MAX(LC2,MAX(LC3,MAX(LC4,LC5))))) AND ZG5!=9999,HC6,9999),NODRAW;
ZG7:=IF(HC7-ZD>0 AND HC7>MAX(LC0,MAX(LC1,MAX(LC2,MAX(LC3,MAX(LC4,MAX(LC5,LC6)))))) AND ZG6!=9999,HC7,9999),NODRAW;
ZG8:=IF(HC8-ZD>0 AND HC8>MAX(LC0,MAX(LC1,MAX(LC2,MAX(LC3,MAX(LC4,MAX(LC5,MAX(LC6,LC7))))))) AND ZG7!=9999,HC8,9999),NODRAW;
ZG:=MIN(ZG0,MIN(ZG1,MIN(ZG2,MIN(ZG3,MIN(ZG4,MIN(ZG5,MIN(ZG6,MIN(ZG7,ZG8))))))));
A:=REF(ZG,BARSLAST(ZG!=REF(ZG,1)));
B:=REF(ZD,BARSLAST(ZD!=REF(ZD,1)));
压力:IF(1,A,A),COLORRED,POINTDOT,LINETHICK4;
支撑:IF(1,B,B),COLORYELLOW,POINTDOT,LINETHICK4;
风险提示:本指标公式仅作为知识分享,不构成任何投资建议,投资有风险,交易需谨慎。
|