您好,登錄后才能下訂單哦!
這篇“R語(yǔ)言A股股票小參數(shù)計(jì)算的方法”文章的知識(shí)點(diǎn)大部分人都不太理解,所以小編給大家總結(jié)了以下內(nèi)容,內(nèi)容詳細(xì),步驟清晰,具有一定的借鑒價(jià)值,希望大家閱讀完這篇文章能有所收獲,下面我們一起來(lái)看看這篇“R語(yǔ)言A股股票小參數(shù)計(jì)算的方法”文章吧。
libname yu "E:\yugao\時(shí)間跨度相關(guān)\TXT"; *sh700000數(shù)據(jù)測(cè)試; data test; set yu.tar(rename=(var1=date var2=open var3=high var4=low var5=close var6=volume var7=amount)); drop amount; run; *計(jì)算R參數(shù),R(21)=C(t)/C(t-21),當(dāng)i<21時(shí),R=C(t)/C(t-i); proc expand data=test out=test_r1 method=none; by id; convert close = lag21_close / transformout = (lag 21); run; data test_r2; set test_r1; by id; r=close/lag21_close; if first.id then close1=close; retain close1; if r=. then r=close/close1; drop close1; run; *計(jì)算參數(shù)S(N*4.236,n,m),N窗口期,n移動(dòng)平均天數(shù),m再次移動(dòng)平均天數(shù),例如S(55,13,3) 公式:S1=(C(t)-L(T))/(H(T)-L(T)),其中t當(dāng)天,T:窗口期內(nèi) S2=MA13(S1)13天的移動(dòng)平均 S3=MA3(S2) 3天地移動(dòng)平均(最終參數(shù)); proc expand data=test out=test_s1 method=none; by id; convert close = h_close / transformin=(movmax 55 ); convert close = l_close / transformin=(movmin 55 ); run; data test_s2; set test_s1; s1=(close - l_close)/(h_close - l_close); run; proc expand data=test_s2 out=test_s3 method=none; by id; convert s1=s2 / transformout=(movave 13); run; proc expand data=test_s3 out=test_s4 method=none; by id; convert s2=s / transformout=(movave 3); run; *計(jì)算參數(shù)B(13,55,3); *HP(t)=max(high(t),close(t-1))取最大值 ; *LP(t)=min(Low(t),close(t-1))取最小值 ; *BULL1=((Close-open)+(open-LP)-(HP-Close))/(HP-LP); *BULL2=SUM13(BULL1) 13天地求和; *BULL3=MA55(BULL2) 55天移動(dòng)平均; *BULL=MA3(BULL3) 3天移動(dòng)平均(最終參數(shù)); proc expand data=test out=test_b1 method=none; by id; convert close=lag_close / transformout=(lag 1 ); run; data test_b2; set test_b1; by id; hp=max(of high lag_close); lp=min(of low lag_close); bull1=((close-open)+(open-lp)-(hp-close))/(hp-lp); run; proc expand data=test_b2 out=test_b3 method=none; convert bull1=bull2 / transformout=( movsum 13 ); run; proc expand data=test_b3 out=test_b4 method=none; convert bull2=bull3 / transformout=( movave 55 ); run; proc expand data=test_b4 out=test_b5 method=none; convert bull3=bull / transformout=( movave 3 ); run; *計(jì)算V1,V2參數(shù) *v(t)當(dāng)天的成交量 *計(jì)算v(t)的55天移動(dòng)平均:MA55(v) *dif(t)= ABS(v(t)-MA55(v)) *m(t)=v(t)/1.618*dif(t-1); proc expand data=test out=test_v11 method=none; by id; convert volume=v_ma55 / transformout=(movave 55); run; data test_v12; set test_v11; v_dif=abs(volume-v_ma55); v_m=volume/(1.618*v_dif); run; *V2參數(shù)計(jì)算; *計(jì)算參數(shù)V2(N*4.236,n,m),N窗口期,n移動(dòng)平均天數(shù),m再次移動(dòng)平均天數(shù),例如v2(55,13,3) 公式:v21=(C(t)-L(T))/(H(T)-L(T)),其中t當(dāng)天,T:窗口期內(nèi) v22=MA13(S1)13天的移動(dòng)平均 v23=MA3(S2) 3天地移動(dòng)平均(最終參數(shù)); proc expand data=test out=test_v21 method=none; by id; convert volume = h_volume / transformin=(movmax 55 ); convert volume = l_volume / transformin=(movmin 55 ); run; data test_v22; set test_v21; v21=(volume - l_volume)/(h_volume - l_volume); run; proc expand data=test_v22 out=test_v23 method=none; by id; convert v21=v22 / transformout=(movave 13); run; proc expand data=test_v23 out=test_v24 method=none; by id; convert v22=v2 / transformout=(movave 3); run;
以上就是關(guān)于“R語(yǔ)言A股股票小參數(shù)計(jì)算的方法”這篇文章的內(nèi)容,相信大家都有了一定的了解,希望小編分享的內(nèi)容對(duì)大家有幫助,若想了解更多相關(guān)的知識(shí)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。