股票线性回归斜率公式(附源码)

股市中,对于股民的计算能力要求还是很高的。最近,很多的股民朋友在向我咨询关于股票线性回归斜率公式的相关内容。下面小编就来具体为大家介绍一下。

新人,编公式看到有这个函数,SLOPE=(X,N)不知道它的公式是怎样的,意义又是什么,请各位资深大哥解答。

{以最小平方法做线性回归估计这直线方程式

y=a+b*x;

最小平方法求出估计值a,b,代入得估计直线}

复制内容到剪贴板代码:

x:=k棒值;

y:=c;

b1:=Σ(x(i)-avr(x,30))*(y(i)-avr(y,30));

b2:=Σ(x(i)-avr(x,30))^2;

b:=b1/b2;

a:=avr(y,30)-b*avr(x,30);

SLOPE=(X,N)

表示以n个值的样本行最小平方法估测直线,slope斜率就是前面的b

回归斜率线A:=EMA(SLOPE(C,4)*20+C,42);

经典RL:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;

经典K:=SMA(经典RL,3,1); 经典D:=SMA(经典K,3,1); 经典J:=3*经典K-2*经典D;

MAHL1:=100*((EMA((H+L)/2,3)-LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))) /(LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))));

MAHL2:=IF(EMA(C,2)>回归斜率线A AND MAHL1>0,EMA(C,3),LLV(EMA((H+L)/2,5),30));{A}

MAHL3:=IF(EMA(C,2)>回归斜率线A AND MAHL1>0,LLV(EMA((H+L)/2,5),30),EMA(C,5));{A}

{回归斜率带:DRAWBAND(回归斜率线A,RGB(235,0,230),REF(回归斜率线A,2),RGB(0,104,154));}

上线:=SMA(C,6.5,1);

一号支撑线:SMA(C,14.5,1);

上线1:=SMA(C,3,1);

一号支撑线1:=SMA(C,8,1);

上线2:=SMA(C,3.5,1);

DRAWTEXT(CROSS(一号支撑线1,上线1),H*1.08,’洗\n盘’),COLOR00FF00;

BBI:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,25))/4;

UPR:=BBI+3*STD(BBI,13);

DWN:=BBI-3*STD(BBI,13);

安全:=MA(CLOSE,55);

LC:=REF(CLOSE,1);

RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;

DRAWTEXT( CROSS(82,RSI) AND CLOSE<上线1 , HIGH*1.04,’减\n仓’) ,COLORFF9966,LINETHICK2;

A7:=(2*C+H+L)/4;

操作:MA(A7,5),COLORYELLOW,LINETHICK2;

操作1:=MA(A7,5)*1.03;

操作2:=MA(A7,5)*0.97;

DRAWTEXT( CROSS(上线1,上线) AND 上线1>操作,LOW *0.92,’买\n进’ ),COLORMAGENTA;

VAR1:LLV(A7,21),COLORBLUE;

VAR2:HHV(A7,30);

DRAWTEXT( CROSS(上线1,操作) AND 上线1<一号支撑线 AND 上线1<一号支撑线1 AND 上线1<上线 AND CLOSE>VAR1,LOW *0.98,’见\n底’ ),COLORCYAN;

YCX:=操作>=REF(操作,1);

H1:=MAX(MAX(上线,一号支撑线1),一号支撑线);

L1:=MIN(MIN(上线,一号支撑线1),一号支撑线);

DRAWTEXT(CROSS(上线1,一号支撑线1) AND 上线1>操作 ,LOW *0.98,’全\n仓’ ),COLORYELLOW;

SK:=EMA((A7-VAR1)/(VAR2-VAR1)*100,7);

SD:=EMA(0.667*REF(SK,1)+0.333*SK,5);

M1:=1000*操作/一号支撑线<=1015 AND 1000*操作/一号支撑线>=975;

M2:=1000*一号支撑线1/一号支撑线<=1020 AND 一号支撑线1/一号支撑线>=980;

M3:=1000*上线/一号支撑线<=1015 AND 上线/一号支撑线>=985;

DRAWTEXT(IF(COUNT(CLOSE6/10 AND

COUNT(SK>SD,6) AND REF(LOW,5)=LLV(LOW,120) AND REF(CLOSE>=OPEN,4) AND

REF(CLOSE>OPEN,3) AND REF(CLOSE>OPEN,2) AND REF(OPEN>CLOSE,1) AND

OPEN>REF(CLOSE,1),1,0),LOW*0.975,’买进’) ,COLORYELLOW;

D:=MA(CLOSE,89)-MA(CLOSE,10)/3;

DRAWTEXT(IF(CLOSEMA(VOL,5)/240 AND CLOSE>REF(CLOSE,1)*1.08

AND CLOSE

RSV:=(CLOSE-LLV(LOW,25))/(HHV(HIGH,25)-LLV(LOW,25))*100;

K:=SMA(RSV,3,1);

D1:=SMA(K,3,1);

J:=3*K-2*D1;

VAR3:=(2*CLOSE+HIGH+LOW)/4;{可将3该为4,信号少点}

VAR4:=EMA(EMA(EMA(VAR3,4),4),4);{可将3该为4,信号少点}

E:=(VAR4-REF(VAR4,1))/REF(VAR4,1)*100;

F:=MA(E,3)+0.03;

G:=MA(E,1);

DRAWTEXT(CROSS(F,G) AND J>65,H*1.08,’走\n人’),COLORWHITE;

{DRAWICON(CROSS(F,G) AND J>65,HIGH*1.02,15),COLORGREEN;}

DRAWICON(CROSS(G,F),VAR1,4),COLORYELLOW;

DRAWTEXT(CLOSE>OPEN AND H1VAR1 AND 上线1>一号支撑线 AND J<90,LOW *0.9,’主\n升’ ),COLORRED;

DRAWTEXT( CROSS(上线1,操作) AND M1 AND M2 AND M3,LOW *0.97,’买\n进’ ),COLORYELLOW;

DRAWTEXT(CLOSE>OPEN AND 上线>一号支撑线1 AND 一号支撑线1>一号支撑线 AND CLOSE>MA(CLOSE,一号支撑线) AND 操作>=REF(CLOSE,操作) AND CROSS(上线1,操作) AND LOW>VAR1 AND J<90,LOW *0.9,’主升’ ),COLORRED;

DRAWTEXT(CLOSE>OPEN AND 操作>上线 AND 上线>一号支撑线1 AND 一号支撑线1>一号支撑线 AND CROSS(上线1,操作) AND LOW>VAR1 AND J<90,LOW *0.86,’回\n踩\n买\n进’ ),COLORGRAY;

DRAWTEXT(CLOSE>OPEN AND CROSS(上线,一号支撑线) AND LOW>VAR1 AND J<90,LOW *0.86,’回\n踩\n买\n进’ ),COLORGRAY;

STICKLINE(CLOSE> REF(CLOSE,1) ,HIGH,LOW,0,0 ),COLORRED;

STICKLINE(CREF(C,1),C,O,3,0),COLORFFCC00;

STICKLINE(CLOSE> REF(CLOSE,1) AND C>O ,OPEN,CLOSE,3,0 ),COLOR000055;{红K};

STICKLINE(CLOSE> REF(CLOSE,1) AND C>O ,OPEN,CLOSE,2.7,0 ),COLOR000077;{红K};

STICKLINE(CLOSE> REF(CLOSE,1) AND C>O ,OPEN,CLOSE,2.1,0 ),COLOR000099;

STICKLINE(CLOSE> REF(CLOSE,1) ,OPEN,CLOSE,1.5,0 ),COLOR0000BB;

STICKLINE(CLOSE> REF(CLOSE,1) ,OPEN,CLOSE,0.9,0 ),COLOR0000DD;

STICKLINE(CLOSE> REF(CLOSE,1) ,OPEN,CLOSE,0.3,0 ),COLOR0000FF;

STICKLINE(CLOSE= REF(CLOSE,1) ,H,L,3,1 ),COLOR999999;

STICKLINE(CLOSE= REF(CLOSE,1) ,HIGH,LOW,0,0 ),COLORWHITE;

STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,3,0 ),COLOR555555;

STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,2.7,0 ),COLOR777777;

STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,2.1,0 ),COLOR999999;

STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,1.5,0 ),COLORBBBBBB;

STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,0.9,0 ),COLORDDDDDD;

STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,0.3,0 ),COLORFFFFFF;

STICKLINE(CLOSE< REF(CLOSE,1) ,HIGH,LOW,0,1 ),COLORCYAN;

STICKLINE(CO,C,O,3,0),COLORFFCC00;

STICKLINE(C

STICKLINE(C

STICKLINE(CLOSE< REF(C,1) ,OPEN,CLOSE,2.1,0 ),COLORFF4400;

STICKLINE(CLOSE< REF(C,1) ,OPEN,CLOSE,1.5,0 ),COLORFF8800;

STICKLINE(CLOSE< REF(C,1) ,OPEN,CLOSE,0.9,0 ),COLORFFCC00;

STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,3.2,0),COLORBB00FF;

STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,2.7,0),COLORFF33FF;

STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,2.1,0), COLORFF66FF;

STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,1.5,0),COLORFF99FF;

STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,0.9,0),COLORFFBBFF;

STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,0.3,0),COLORFFDDFF;

换手:VOL/CAPITAL*100{,NODRAW},LINETHICK0;

内外%:BUYVOL/SELLVOL,LINETHICK0;

以上是小编为大家讲解的关于股票线性回归斜率公式的内容,希望小编的内容能帮助到大家。关于股市的更多知识,小编后续会陆续为大家带来,请大家持续关注股票投资。

本文内容仅代表作者观点,不代表本站立场,如若转载,请注明出处:https://www.fx220.com/news/22894.html

发表评论

邮箱地址不会被公开。 必填项已用*标注