HTS程式交易語法大全--CurrentBar


CurrentBar

BarNumber函數把資料由左邊加一個數字來計算,但是CurrentBar碰到使用者已經指定某一種文章的同時,如果那文章的條件適合的話就開始計算。
比如說5天移動平均出現在文章內的話,像下面所列出的表示:
Data Series1 2 3 4 5 6 7 8 9 10 11 12 .....
Bar Number1 2 3 4 5 6 7 8 9 10 11 12 ...
Current Bar1 1 1 1 1 2 3 4 5 6 7 8 .... 
如果沒有使用者所指定的文章,BarNumberCurrentBar的值會相同,但使用者也會有指定文章的情況,那麼BarNumberCurrentBar會不一樣的。
注意:
無法參照過去價值。(CurrentBar[5] =>不可行)
CurrentBar通常和If一起使用。
If CurrentBar > 1 Then
還有 If CurrentBar = 1 Then
透過像上面一般等等的構文,請記住要執行某種條件附加性的作用。
範例:
IF Condition1 then
      Value1 = CurrentBar
End if

IF CurrentBar > Value1 then
       Value2 = CurrentBar - Value1
End if


沒有留言:

張貼留言

《HTS程式交易教學》[教學信號]KD買賣訊號範例[免費訊號教學]

Parameters : HighLowTerm(9), kLength(3), dLength(3), OverSold(20), OverBought(80) variables:value(0),value2(0); 1.系統平台僅供參考,投資人仍需自行判斷負責,本人...