金字塔的橫向統(tǒng)計(jì)功能 自定義數(shù)據(jù)橫向排名統(tǒng)計(jì)功能實(shí)現(xiàn)策略回測(cè)的方法和步驟[金字塔模型]
: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">金字塔的橫向統(tǒng)計(jì)功能是一個(gè)十分強(qiáng)大的功能,尤其是針對(duì)股票市場(chǎng)品種數(shù)據(jù)大的特點(diǎn),更是在我們的量化交易統(tǒng)計(jì)過(guò)程中發(fā)揮巨大的優(yōu)勢(shì)。舉例來(lái)說(shuō):: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 我們的策略實(shí)現(xiàn)如下功能:尋找漲幅排名在30名之前,并且MA均線處于金叉位置的股票,實(shí)現(xiàn)買進(jìn),出現(xiàn)死叉的持倉(cāng)股票,賣出。: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 為了實(shí)現(xiàn)上述策略,我們要將策略分成2個(gè)部分來(lái)完成,第一要完成股票在市場(chǎng)當(dāng)中的漲跌幅排名,第二就是要判斷是否金叉和死叉。: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 排名統(tǒng)計(jì)就需要借助橫向統(tǒng)計(jì)功能,先為我們統(tǒng)計(jì)出來(lái)個(gè)股在整個(gè)市場(chǎng)的漲跌幅排名情況。雖然我們可以在公式中自行完成統(tǒng)計(jì)工作,但是計(jì)算量是十分巨大的,這樣的公式編寫出來(lái)也幾乎是沒(méi)法正常使用的,幸好金字塔為我們提供了非常有價(jià)值的橫向統(tǒng)計(jì)自定義數(shù)據(jù)的功能,有了這個(gè)功能,再?gòu)?fù)雜的統(tǒng)計(jì)工作,我們都可以非常輕松的來(lái)完成,而且是效率非常高的。并且自定義數(shù)據(jù)不僅僅可以用來(lái)做統(tǒng)計(jì),像類似跨周期數(shù)據(jù)引用這樣的工作,我們也都可以用他來(lái)幫我們完成,喜歡使用跨周期引用的朋友可以自定嘗試,使用自定義數(shù)據(jù)和你自己在公式中使用STKINDI他們的效率差別。好了言歸正傳,下面來(lái)介紹統(tǒng)計(jì)橫向排名的步驟:: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">??第一步,建立一個(gè)技術(shù)指標(biāo)公式,用來(lái)統(tǒng)計(jì)漲跌幅,名稱為 Formula2,代碼為:: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 第二步,我們進(jìn)行橫向排名統(tǒng)計(jì),分析菜單->自定義數(shù)據(jù),打開(kāi)自定義數(shù)據(jù)窗口,本例中我們以日線數(shù)據(jù)做統(tǒng)計(jì),: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">
: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 新建一個(gè)“證券相關(guān)序列”,名稱為“漲幅排”的自定義數(shù)據(jù)序列,選擇我們前面建立的公式指標(biāo),統(tǒng)計(jì)周期選擇日線,如果你除了測(cè)評(píng)外還需要盤中做后臺(tái)程序化交易,那么你還需要勾選“自動(dòng)更新”這個(gè)選項(xiàng),這里的重點(diǎn)選項(xiàng)是需要你勾選“生成橫向排名數(shù)據(jù)”,只有你勾選了這個(gè)選項(xiàng)后,才可以對(duì)漲跌幅這個(gè)數(shù)據(jù)做排名的哦。最后確認(rèn)你的計(jì)算范圍,要選擇對(duì)“上海A股”整個(gè)市場(chǎng)板塊進(jìn)行統(tǒng)計(jì)。: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 設(shè)置完畢后,我們需要點(diǎn)“刷新”按鈕進(jìn)行刷新,: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">? 這里重點(diǎn)提醒的是,如果你需要測(cè)評(píng),那么你應(yīng)該選擇刷新指定數(shù)量的數(shù)據(jù),如果你是做實(shí)盤程序化使用,那么這個(gè)數(shù)量應(yīng)該盡可能設(shè)小,以加快橫向統(tǒng)計(jì)的處理速度。: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">??刷新完畢后,我們可以人工打開(kāi)一個(gè)品種看一下刷新的數(shù)據(jù)是否正確,比如我們以浦發(fā)銀行為例:: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">
: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?接下來(lái)最后一步就是進(jìn)行程序化交易測(cè)評(píng)的公式編寫部分了,按照上述的要求編寫的程序化交易的代碼如下:: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?這里重點(diǎn)介紹的函數(shù)SELFDATA,用這個(gè)函數(shù)可以直接讀取我們之前設(shè)定的自定義數(shù)據(jù)。用法非常簡(jiǎn)單,我想通過(guò)上述的代碼用戶應(yīng)該不難理解他的使用。: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?上述代碼編寫完畢后,我們就可以進(jìn)行我們的測(cè)試工作啦,下面是測(cè)試報(bào)告。: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">==========================================================================: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">有關(guān)自定義數(shù)據(jù)的屬性類型的說(shuō)明:: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">?: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">
: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">
: none; color: rgb(85,85,85); font-style: normal; widows: 1; letter-spacing: normal; line-height: 18px; background-color: rgb(246,249,251); text-indent: 0px; -webkit-text-stroke-width: 0px">
橫向統(tǒng)計(jì)序列:將所有的品種進(jìn)行統(tǒng)計(jì),統(tǒng)計(jì)結(jié)果擬合到一個(gè)結(jié)果中,例如我們可以統(tǒng)計(jì)滬深A(yù)股的上漲,下跌家數(shù),以及指標(biāo)值的累加,例如統(tǒng)計(jì)滬深A(yù)股出現(xiàn)MA均線金叉的家數(shù)等等。
?
{別忘了將本網(wǎng)告訴您身邊的朋友,向朋友傳達(dá)有用資料,也是一種人情,你朋友會(huì)感謝你的。}
?
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容