Announcement

Collapse
No announcement yet.

ref() and getValue()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ref() and getValue()

    Im having trouble understanding the difference between ref() and getValue.

    I would like to know if the high for the current bar is >= the high for the previous 10 bars.

    When i caclulate

    high() >= Highest(10, high())

    Highest(10,high()) seems to include the current bar.

    In Metastock, I would write ref( Highest(10, high()), -1) , but the documentation for ref() has no example like that.

    I see that getValue has a 'nOffset' parm but I doesn't look like I can put Highest(..) as the bar type.



  • #2
    kztd
    In eSignal ref() is used to retrieve historical values of an item in the return statement.
    To answer your question highest() does include the current bar in its calculations. The solution to what you are trying to do is shown below
    Alex

    PHP Code:
    var HighH highest(10,high());
    if(
    high(0) > HighH.getValue(-1)){
    //etc

    Comment

    Working...
    X