對crossover內建函數有幾點疑問 [開拓者 TB]
- 咨詢內容:
//------------------------------------------------------------------------
// 簡稱: CrossOver
// 名稱: 求是否上穿
// 類別: 用戶函數
// 類型: 內建函數
// 輸出: 布爾型
//------------------------------------------------------------------------
Params
NumericSeries Price1(1);
NumericSeries Price2(1);
Vars
Bool Con1(False);
Bool PreCon(False);
Numeric Counter(0);
Begin
If(Price1 > Price2)
{
Counter = 1;
Con1 = Price1[1] == Price2[1];
While (Con1 and Counter < CurrentBar) {
Counter = Counter + 1;
Con1 = Price1[Counter] == Price2[Counter];
}
PreCon = Price1[Counter] < Price2[Counter];
Return PreCon;
}Else
{
Return False;
}
End
//------------------------------------------------------------------------
// 編譯版本 GS2010.12.08
// 版權所有 TradeBlazer Software 2003-2010
// 更改聲明 TradeBlazer Software保留對TradeBlazer平
// 臺每一版本的TradeBlazer公式修改和重寫的權利
//------------------------------------------------------------------------
紅色con1的表達式或者數值是哪一個,紅色Counter < CurrentBar,counter和currentbar能比較嗎?這里的counter包含的數值是哪些呢?
- TB技術人員:
con1在前面的語句里賦值了呀,Price1[1] == Price2[1],就是判斷這兩個價格是否相等,滿足條件之后,繼續向前回溯,[]中用counter計數
counter為什么不能和currentbar比較呢?這里主要的意思是回溯的值不能超過當前currentbar的索引值,是為了保證回溯有效的的。counter用于回溯計數,在前面賦值了,最開始是1,然后滿足條件的時候每次增加1. - TB客服:
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容