CurrentBar
BarNumber函數把資料由左邊加一個數字來計算,但是CurrentBar碰到使用者已經指定某一種文章的同時,如果那文章的條件適合的話就開始計算。
比如說5天移動平均出現在文章內的話,像下面所列出的表示:
Data
Series:1 2 3 4 5
6 7 8 9 10 11 12 .....
Bar Number:1 2 3 4 5 6 7 8 9 10 11 12
...
Current Bar:1 1 1 1 1 2 3 4 5 6 7 8 ....
如果沒有使用者所指定的文章,BarNumber和CurrentBar的值會相同,但使用者也會有指定文章的情況,那麼BarNumber和CurrentBar會不一樣的。
注意:
無法參照過去價值。(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
沒有留言:
張貼留言