TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,10);
MEDIAN:= (HIGH + LOW ) / 2;
上证指数:=INBLOCK('上证A股');
深证成指:=INBLOCK('深证A股');
平均股价:=C;}
UP:=MEDIAN+ATR * IF(C=上证指数,2.1,2.2);
DN:=MEDIAN-ATR * IF(C=上证指数,2.1,2.2);
L1:=REF(UP,BARSLAST(UP<=REF(UP,1)));
L2:=LLV(UP,15);
LL:=IF(L2=REF(L2,1) AND L1<REF(L1,1),L1,IF(L1=L2,L1,L2));
S1:=BARSLAST(CROSS(0.5,UP=LL))+1 OR BARSLAST(CROSS(1.5,UP=LL))+1 OR BARSLAST(CROSS(2.5,UP=LL))+1 OR BARSLAST(CROSS(3.5,UP=LL))+1,NODRAW;
S2:=CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),0.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),1.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),2.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),3.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),4.5);
A6:=BARSLAST(S2);
B6:=BARSLAST(CROSS(HHV(DN,A6+1),C));
支撑:IF(B6>A6,HHV(DN,BARSLAST(CROSS(B6,A6))+1),DRAWNULL),COLORRED,LINETHICK2;
压力:IF(B6<A6,LLV(UP,BARSLAST(CROSS(A6,B6))+1),DRAWNULL),COLORGREEN,LINETHICK2;
AAA:=(3*C+H+L+O)/6;
VAR1:=EMA(AAA,35);
VAR2:=(HHV(VAR1,5)+HHV(VAR1,15)+HHV(VAR1,30))/3;
VAR3:=(LLV(VAR1,5)+LLV(VAR1,15)+LLV(VAR1,30))/3;
牛线:=(HHV(VAR2,5)+HHV(VAR2,15)+HHV(VAR2,30))/3;
熊线:=(LLV(VAR3,5)+LLV(VAR3,15)+LLV(VAR3,30))/3;
疯熊:=熊线*0.90;
SPRING:=B6>A6;
春:IF(SPRING,1,DRAWNULL),COLOR3D3DFF,NODRAW;
STICKLINE(SPRING AND C>O,O,C,8/3,1),COLOR3D3DFF;
STICKLINE(SPRING AND C>O,H,C,1,1),COLOR3D3DFF;
STICKLINE(SPRING AND C>O,O,L,1,1),COLOR3D3DFF;
STICKLINE(SPRING AND C<O,O,C,8/3,0),COLOR3D3DFF;
STICKLINE(SPRING AND C<O,H,C,1,0),COLOR3D3DFF;
STICKLINE(SPRING AND C<O,O,L,1,0),COLOR3D3DFF;
STICKLINE(SPRING AND C=O,O,C,8/3,0),COLOR3D3DFF;
STICKLINE(SPRING AND C=O,H,C,1,0),COLOR3D3DFF;
STICKLINE(SPRING AND C=O,O,L,1,0),COLOR3D3DFF;
SUMMER:=NOT(AAA<熊线 AND AAA>=疯熊 AND B6<A6) AND NOT(AAA<疯熊) AND NOT(B6>A6);
夏:IF(SUMMER,1,DRAWNULL),COLORYELLOW,NODRAW;
STICKLINE(SUMMER AND C>O,O,C,8/3,1),COLORYELLOW;
STICKLINE(SUMMER AND C>O,H,C,1,1),COLORYELLOW;
STICKLINE(SUMMER AND C>O,O,L,1,1),COLORYELLOW;
STICKLINE(SUMMER AND C<O,O,C,8/3,0),COLORYELLOW;
STICKLINE(SUMMER AND C<O,H,C,1,0),COLORYELLOW;
STICKLINE(SUMMER AND C<O,O,L,1,0),COLORYELLOW;
STICKLINE(SUMMER AND C=O,O,C,8/3,0),COLORYELLOW;
STICKLINE(SUMMER AND C=O,H,C,1,0),COLORYELLOW;
STICKLINE(SUMMER AND C=O,O,L,1,0),COLORYELLOW;
AUTUMN:=AAA<熊线 AND AAA>=疯熊 AND B6<A6;
秋:IF(AUTUMN,1,DRAWNULL),COLOR7DC739,NODRAW;
STICKLINE(AUTUMN AND C>O,O,C,8/3,1),COLOR7DC739;
STICKLINE(AUTUMN AND C>O,H,C,1,1),COLOR7DC739;
STICKLINE(AUTUMN AND C>O,O,L,1,1),COLOR7DC739;
STICKLINE(AUTUMN AND C<O,O,C,8/3,0),COLOR7DC739;
STICKLINE(AUTUMN AND C<O,H,C,1,0),COLOR7DC739;
STICKLINE(AUTUMN AND C<O,O,L,1,0),COLOR7DC739;
STICKLINE(AUTUMN AND C=O,O,C,8/3,0),COLOR7DC739;
STICKLINE(AUTUMN AND C=O,H,C,1,0),COLOR7DC739;
STICKLINE(AUTUMN AND C=O,O,L,1,0),COLOR7DC739;
WINTER:=AAA<疯熊;
冬:IF(WINTER,1,DRAWNULL),COLORFC9D53,NODRAW;
STICKLINE(WINTER AND C>O,O,C,8/3,1),COLORFC9D53;
STICKLINE(WINTER AND C>O,H,C,1,1),COLORFC9D53;
STICKLINE(WINTER AND C>O,O,L,1,1),COLORFC9D53;
STICKLINE(WINTER AND C<O,O,C,8/3,0),COLORFC9D53;
STICKLINE(WINTER AND C<O,H,C,1,0),COLORFC9D53;
STICKLINE(WINTER AND C<O,O,L,1,0),COLORFC9D53;
STICKLINE(WINTER AND C=O,O,C,8/3,0),COLORFC9D53;
STICKLINE(WINTER AND C=O,H,C,1,0),COLORFC9D53;