開拓者 TB一個系統(tǒng)自帶的NthCon函數(shù)
作者:開拓者 TB 來源:cxh99.com 發(fā)布時間:2013年05月13日
- 咨詢內容: 列一個系統(tǒng)自帶的NthCon函數(shù)
簡稱: NthCon
// 名稱: 第N個滿足條件的Bar距當前的Bar數(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
請問最后For i = 2 To N那句,后面沒有再出現(xiàn)變量“i”呀,怎么循環(huán)呢?不是都是應該下面這種例子
For i = 2 To N
{
M = M + Price[i];
}
這種嗎?要出現(xiàn)有“i”的變量才行吧?謝謝哪位高人能幫我解答一下!
- TB技術人員: 沒有i當然可以循環(huán)
就是把循環(huán)體執(zhí)行N-2+1次