{线性回归画线}
UR:=15;
LR:=15;
{可调}
:=IF(C=HHV(C,5*UR),C,NULL);
TC2:=REFX1(BARSLAST(TC1=C),10000)+1;
BC1:=IF(L=LLV(L,5*LR),L,NULL);
BC2:=REFX1(BARSLAST(BC1=L),10000)+1;
NOD:=(IF(TC2 BC2,TC2,BC2)-IF(TC2 BC2,BC2,TC2));
LR1:=FORCAST(C,NOD+1);
CURRBARSCOUNT:=DATACOUNT-BARPOS+1;
NP:=IF(CURRBARSCOUNT =MAX(BC2,TC2),REFX1(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1)),10000),NULL),POINTDOT,COLOR93BDA8;
LR2:=SLOPE(C,NOD+1);
LR3:=REFX1(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)),10000);
FP:=NP-LR3*(NOD),POINTDOT,COLOR93BDA8;
AD:=ABS(NP-FP);
DBL:=BARSLAST(ISNULL(BC1))+1;
DBH:=BARSLAST(ISNULL(TC1))+1;
BSP:=IF(BC2 TC2,DBL,DBH)-1;
LRL:=IF(NP FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND C LRL,C,LRL);
AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
AT3:=REFX1(BARSLAST(AT1-LRL=AT2),10000);
AT5:=REFX1(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)),10000);
ATL:=LRL+AT5;
UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L LRL,L,LRL);
UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
UT3:=REFX1(BARSLAST(LRL-UT1=UT2),10000);
UT5:=REFX1(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)),10000);
UTL:=LRL-UT5;
RH:=IF(CURRBARSCOUNT =MIN(BC2,TC2)-10,ATL,REFX1(REF(ATL,MIN(BC2,TC2)-11),10000));
RL:=IF(CURRBARSCOUNT =MIN(BC2,TC2)-10,UTL,REFX1(REF(UTL,MIN(BC2,TC2)-11),10000));
中轨:=IF(NP FP,IF(LRL =RH,LRL,NULL),IF(LRL =RL,LRL,NULL)),COLORCYAN;
上轨12:IF(NP FP,IF(ATL =RH,ATL,NULL),IF(ATL =RL,ATL,NULL)),COLORCYAN;
下轨12:IF(NP FP,IF(UTL =RH,UTL,NULL),IF(UTL =RL,UTL,NULL)),COLORCYAN;
URA:=5;
LRA:=5;
{可调}
TC1A:=IF(C=HHV(C,5*URA),C,NULL);
TC2A:=REFX(BARSLAST(TC1A=C),10000)+1;
BC1A:=IF(L=LLV(L,5*LRA),L,NULL);
BC2A:=REFX(BARSLAST(BC1A=L),10000)+1;
NODA:=(IF(TC2A BC2A,TC2A,BC2A)-IF(TC2A BC2A,BC2A,TC2A));
LR1A:=FORCAST(C,NODA+1);
:=IF(CURRBARSCOUNT =MAX(BC2A,TC2A),REFX(IF(MIN(TC2A,BC2A)=1,LR1A,REF(LR1A,MIN(TC2A,BC2A)-1)),10000),NULL),POINTDOT,COLOR93BDA8;
LR2A:=SLOPE(C,NODA+1);
LR3A:=REFX(IF(MIN(TC2A,BC2A)=1,LR2A,REF(LR2A,MIN(TC2A,BC2A)-1)),10000);
FPA:=NPA-LR3A*(NODA),POINTDOT,COLOR93BDA8;
ADA:=ABS(NPA-FPA);
DBLA:=BARSLAST(ISNULL(BC1A))+1;
DBHA:=BARSLAST(ISNULL(TC1A))+1;
BSPA:=IF(BC2A TC2A,DBLA,DBHA)-1;
LRLA:=IF(NPA FPA,FPA+ADA/NODA*BSPA,FPA-ADA/NODA*BSPA);
AT1A:=IF(BETWEEN(CURRBARSCOUNT,BC2A,TC2A) AND C LRLA,C,LRLA);
AT2A:=HHV(AT1A-LRLA,MAX(BC2A,TC2A));
AT3A:=REFX(BARSLAST(AT1A-LRLA=AT2A),10000);
AT5A:=REFX(IF(AT3A=0,AT1A-LRLA,REF(AT1A-LRLA,AT3A)),10000);
ATLA:=LRLA+AT5A;
UT1A:=IF(BETWEEN(CURRBARSCOUNT,BC2A,TC2A) AND L LRLA,L,LRLA);
UT2A:=HHV(LRLA-UT1A,MAX(BC2A,TC2A));
UT3A:=REFX(BARSLAST(LRLA-UT1A=UT2A),10000);
UT5A:=REFX(IF(UT3A=0,LRLA-UT1A,REF(LRLA-UT1A,UT3A)),10000);
UTLA:=LRLA-UT5A;
RHA:=IF(CURRBARSCOUNT =MIN(BC2A,TC2A)-10,ATLA,REFX1(REF(ATLA,MIN(BC2A,TC2A)-11),10000));
RLA:=IF(CURRBARSCOUNT =MIN(BC2A,TC2A)-10,UTLA,REFX1(REF(UTLA,MIN(BC2A,TC2)-11),10000));
中轨A:=IF(NPA FPA,IF(LRLA =RHA,LRLA,NULL),IF(LRLA =RLA,LRLA,NULL)),COLOR628962;
上轨12A:IF(NPA FPA,IF(ATLA =RHA,ATLA,NULL),IF(ATLA =RLA,ATLA,NULL)),COLORWHITE;
下轨12A:IF(NPA FPA,IF(UTLA =RHA,UTLA,NULL),IF(UTLA =RLA,UTLA,NULL)),COLORWHITE;
买线:=EMA(C,2);
卖线:=EMA(SLOPE(C,21)*20+C,42);
BU:=CROSS(买线,卖线);
SEL:=CROSS(卖线,买线);
DRAWICON(BU,L-0.1,1);
DRAWICON(SEL,H+0.1,2);
STICKLINE(买线 =卖线,LOW,HIGH,0.0,1),COLORRED;
STICKLINE(买线 =卖线,CLOSE,OPEN,2,1),COLORRED;
STICKLINE(买线 卖线,LOW,HIGH,0.0,1),COLORGREEN;
STICKLINE(买线 卖线,CLOSE,OPEN,2,1),COLORGREEN;
STICKLINE(BU,OPEN,CLOSE,2,0),COLORYELLOW;
STICKLINE(SEL,OPEN,CLOSE,2,0),COLORBLUE;
主力:EMA(CLOSE,10),COLORRED;
散户:EMA(CLOSE,5),COLORYELLOW;
绿降:(46.18*EMA(CLOSE,10)-31.82*EMA(CLOSE,4))/14.36,COLORGREEN,LINETHICK1;
操盘:MA(CLOSE,9),COLORWHITE,LINETHICK2;
界点:MA(CLOSE,20),COLORMAGENTA;
REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
DRAWTEXT(CROSS(FF,MA15),(LOW * 0.99), 底背离 ),COLOR0000FF;
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR,14);
{大智慧加上这两句定义}
AA:=(HHV(HIGH,20) - (2 * ATR));
BB:=CROSS(CLOSE,REF(HHV(HIGH,55),1));
SSS:=CROSS(MIN(MA(CLOSE,13),AA),CLOSE);
BBB:=BARSLAST(BB);
SSSB:=BARSLAST(SSS);
B1:=((BBB = 0) AND (REF(SSSB,1) REF(BBB,1)));
B1B:=BARSLAST(B1);
B2:=((((BB = 1) AND (B1B SSSB)) AND (B1B 0)) AND (COUNT(BB,SSSB) 3));
B2B:=BARSLAST(B2);
B3:=((((BB = 1) AND (B2B B1B)) AND (COUNT(BB,SSSB) 4)) AND (COUNT(BB,SSSB) 2));
DRAWTEXT((B1 = 1),(LOW - 0.6), 跟进 ),COLORYELLOW;
DRAWTEXT((B2 = 1),(LOW - 0.6), 加码 ),COLORFFAAFF;