: 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)計功能是一個十分強大的功能,尤其是針對股票市場品種數(shù)據(jù)大的特點,更是在我們的量化交易統(tǒng)計過程中發(fā)揮巨大的優(yōu)勢。舉例來說:: 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">? 我們的策略實現(xiàn)如下功能:尋找漲幅排名在30名之前,并且MA均線處于金叉位置的股票,實現(xiàn)買進,出現(xià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">? 為了實現(xiàn)上述策略,我們要將策略分成2個部分來完成,第一要完成股票在市場當(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)計就需要借助橫向統(tǒng)計功能,先為我們統(tǒng)計出來個股在整個市場的漲跌幅排名情況。雖然我們可以在公式中自行完成統(tǒng)計工作,但是計算量是十分巨大的,這樣的公式編寫出來也幾乎是沒法正常使用的,幸好金字塔為我們提供了非常有價值的橫向統(tǒng)計自定義數(shù)據(jù)的功能,有了這個功能,再復(fù)雜的統(tǒng)計工作,我們都可以非常輕松的來完成,而且是效率非常高的。并且自定義數(shù)據(jù)不僅僅可以用來做統(tǒng)計,像類似跨周期數(shù)據(jù)引用這樣的工作,我們也都可以用他來幫我們完成,喜歡使用跨周期引用的朋友可以自定嘗試,使用自定義數(shù)據(jù)和你自己在公式中使用STKINDI他們的效率差別。好了言歸正傳,下面來介紹統(tǒ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">??第一步,建立一個技術(shù)指標(biāo)公式,用來統(tǒng)計漲跌幅,名稱為 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">? 第二步,我們進行橫向排名統(tǒng)計,分析菜單->自定義數(shù)據(jù),打開自定義數(shù)據(jù)窗口,本例中我們以日線數(shù)據(jù)做統(tǒ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">? 新建一個“證券相關(guān)序列”,名稱為“漲幅排”的自定義數(shù)據(jù)序列,選擇我們前面建立的公式指標(biāo),統(tǒng)計周期選擇日線,如果你除了測評外還需要盤中做后臺程序化交易,那么你還需要勾選“自動更新”這個選項,這里的重點選項是需要你勾選“生成橫向排名數(shù)據(jù)”,只有你勾選了這個選項后,才可以對漲跌幅這個數(shù)據(jù)做排名的哦。最后確認(rèn)你的計算范圍,要選擇對“上海A股”整個市場板塊進行統(tǒ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è)置完畢后,我們需要點“刷新”按鈕進行刷新,: 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">? 這里重點提醒的是,如果你需要測評,那么你應(yīng)該選擇刷新指定數(shù)量的數(shù)據(jù),如果你是做實盤程序化使用,那么這個數(shù)量應(yīng)該盡可能設(shè)小,以加快橫向統(tǒ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ù)據(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">?接下來最后一步就是進行程序化交易測評的公式編寫部分了,按照上述的要求編寫的程序化交易的代碼如下:: 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">?這里重點介紹的函數(shù)SELFDATA,用這個函數(shù)可以直接讀取我們之前設(shè)定的自定義數(shù)據(jù)。用法非常簡單,我想通過上述的代碼用戶應(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">?上述代碼編寫完畢后,我們就可以進行我們的測試工作啦,下面是測試報告。: 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ù)的屬性類型的說明:: 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)計序列:將所有的品種進行統(tǒng)計,統(tǒng)計結(jié)果擬合到一個結(jié)果中,例如我們可以統(tǒng)計滬深A(yù)股的上漲,下跌家數(shù),以及指標(biāo)值的累加,例如統(tǒng)計滬深A(yù)股出現(xiàn)MA均線金叉的家數(shù)等等。
?
{別忘了將本網(wǎng)告訴您身邊的朋友,向朋友傳達(dá)有用資料,也是一種人情,你朋友會感謝你的。}
?