開(kāi)拓者1分鐘圖里面取道5分鐘的數(shù)據(jù)的均線 源碼[開(kāi)拓者公式]
- 內(nèi)容: 使用環(huán)境:
基本數(shù)據(jù)源為1分鐘,通過(guò)DataConvert可以轉(zhuǎn)化為對(duì)應(yīng)的5分鐘數(shù)據(jù),有些朋友希望能夠在1分鐘圖里面取道5分鐘的數(shù)據(jù)的均線,效果要和單獨(dú)使用5分鐘的均線一樣。為此,提供以下函數(shù)。
1、新建一個(gè)用戶(hù)函數(shù),TransMinsData,返回值為數(shù)值型。
參數(shù)1:要計(jì)算的數(shù)據(jù)源。
參數(shù)2:想按N分鐘來(lái)處理,本例是5分鐘,不能大于60。
參數(shù)3:希望取多少個(gè)N分鐘前的數(shù)據(jù)。- Params
- NumericSeries Price(1);
- Numeric nMinSet(5);
- Numeric MinsAgo(2);
- Vars
- NumericSeries barCnt;
- NumericSeries MinData;
- Numeric i;
- Numeric j;
- Numeric nIndex(0);
- Begin
- If(IntPart(Minute%nMinSet)==0)
- {
- barCnt = 1;
- }Else
- {
- barCnt = barCnt[1] + 1;
- }
- MinData = Price;
- If(MinsAgo == 0)
- {
- return MinData;
- }Else
- {
- For i = 1 To MinsAgo
- {
- If( i == 1)
- {
- j = 0;
- }Else
- {
- j = j + BarCnt[j];
- }
- If (j > CurrentBar ) Return InvalidNumeric;
- nIndex = nIndex + BarCnt[j];
- }
- Return MinData[nIndex];
- }
- End
有思路,想編寫(xiě)各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進(jìn)行 有償 編寫(xiě)!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容