跨周期問題 - TradeBlazer公式 [開拓者 TB]
- 咨詢內容:
能不能寫一個15分鐘跨周期取30分鐘和60分鐘MA的例子?老大寫的幾個我都看了,實在是不知道要怎么寫
- TB技術人員:
老大?????
這個是TransMinsData30
- TB客服:
本帖最后由 01011012 于 2011-10-19 14:20 編輯
Params
NumericSeries Price(1);
Numeric nMinSet(30);
Numeric MinsAgo(0);
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 - 網友回復:
//------------------------------------------------------------------------
// 簡稱: TransMinsData
// 名稱: 1小時內跨周期
// 類別: 用戶函數
// 類型: 用戶函數
// 輸出: 數值型
//參數1:要計算的數據源。參數2:想按N分鐘來處理,本例是5分鐘,不能大于60。參數3:希望取多少個N分鐘前的數據
//------------------------------------------------------------------------
Params
NumericSeries Price(1);
Numeric nMinSet(60);
Numeric MinsAgo(0);
Vars
NumericSeries barCnt;
NumericSeries MinData;
Numeric i;
Numeric j;
Numeric nIndex(0);
Begin
If(IntPart((Hour*60+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
//------------------------------------------------------------------------
// 編譯版本 - 網友回復:
Params
Numeric Length(55);
Vars
NumericSeries MyClose30;
NumericSeries MyClose60;
NumericSeries MA15;
NumericSeries MA30;
NumericSeries MA60;
Numeric SumValue30(0);
Numeric SumValue60(0);
Numeric Value30;
Numeric Value60;
Numeric i;
Begin
MyClose30 = DataConvert(Close,"min",30,"Close");
MyClose60 = DataConvert(Close,"min",60,"Close");
For i = Length-1 DownTo 0
{
Value30 = TransMinsData30(MyClose30,30,i);
Value60 = TransMinsData(MyClose60,60,i);
SumValue30 = SumValue30 + Value30;
SumValue60 = SumValue60 + Value60;
}
ma60=SumValue60/Length;
ma30=SumValue30/Length;
ma15=AverageFC(Close,Length);
PlotNumeric("my30",ma30);
PlotNumeric("ma15",ma15);
PlotNumeric("MA60",MA60);
End
如果以上指標公式不適用于您常用的行情軟件
或者您想改編成選股公式,以便快速選出某種形態個股的話,
- 上一篇:V4版的無效值傳遞機制的問題 - TradeBlaz…
- 下一篇:沒有了!
相關文章
-
沒有相關內容