NthCon 函數(shù)改寫求助 [開拓者 TB]
- 咨詢內容:
本帖最后由 ego90289698 于 2016-2-22 15:25 編輯
請問下各位老大, NthCon 這個函數(shù)改寫問題。
//------------------------------------------------------------------------
// 簡稱: NthCon
// 名稱: 第N個滿足條件的Bar距當前的Bar數(shù)目-========》需要改成 “第N個滿足條件的Bar距前天的Bar數(shù)目”
// 類別: 用戶函數(shù)
// 類型: 內建函數(shù)
// 輸出: 數(shù)值型
//------------------------------------------------------------------------
Params
Bool Con(false);
Numeric N(1);
Vars
NumericSeries PreConIndex;
NumericSeries BarNums;
Numeric i(0);
Numeric ReBars(0);
Begin
If(Con)
{
BarNums = 0;
PreConIndex = BarNums[1] + 1;
}Else
{
BarNums = BarNums + 1;
PreConIndex = BarNums;
}
ReBars = BarNums;
For i = 2 To N
{
ReBars = ReBars + PreConIndex[ReBars];
}
Return ReBars;
End
//------------------------------------------------------------------------
// 編譯版本 GS2010.12.08
// 版權所有 TradeBlazer Software 2003-2010
// 更改聲明 TradeBlazer Software保留對TradeBlazer平
// 臺每一版本的TradeBlazer公式修改和重寫的權利
//------------------------------------------------------------------------ - TB技術人員:
高手們指點一下唄,請別潛水了。
- TB客服:
距前天的Bar?
是日線?
這樣rebars-2就好了
或不是日線,前天的第幾根bar?第一根?
- 網友回復:
本帖最后由 bahuang 于 2016-2-25 14:39 編輯
//------------------------------------------------------------------------
// 簡稱: NthConBeforeYesterday
// 名稱: 第N個符合條件,距離前天第一根bar的個數(shù).
// 類別: 用戶函數(shù)
// 類型: 用戶函數(shù)
// 輸出: 數(shù)值型
//------------------------------------------------------------------------
Params
Bool Con(false);
Numeric N(1);
Vars
NumericSeries PreConIndex;
NumericSeries BarNums;
Numeric i(0);
Numeric ReBars(0);
//
NumericSeries barCnt;
NumericSeries barCntYesterday;
NumericSeries barCntBeforeYesterday;
Numeric diffBar;
Begin
If(Con)
{
BarNums = 0;
PreConIndex = BarNums[1] + 1;
}Else
{
BarNums = BarNums + 1;
PreConIndex = BarNums;
}
ReBars = BarNums;
For i = 2 To N
{
ReBars = ReBars + PreConIndex[ReBars];
}
//
If(BarStatus == 0)
{
barCntBeforeYesterday=0;
barCntYesterday=0;
barCnt = 1;
}Else If(TrueDate(0)!=TrueDate(1))
{
barCntBeforeYesterday=barCntYesterday;
barCntYesterday=barCnt;
barCnt = 1;
}Else
{
barCnt=barCnt+1;
}
diffBar=barCntBeforeYesterday+barCntYesterday+barCnt;
Return ReBars-diffBar;
End
//------------------------------------------------------------------------
// 編譯版本 GS2010.12.08
// 用戶版本 2016-02-25 11:12:33
// 版權所有 bahuang
// 更改聲明 TradeBlazer Software保留對TradeBlazer平臺
// 每一版本的TrabeBlazer公式修改和重寫的權利
//------------------------------------------------------------------------ - 網友回復:
沒測試,懶得測 不知道寫的對不對
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯(lián)系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容