Announcement

Collapse
No announcement yet.

past values

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

  • past values

    Hi,

    Is there any way to get past values of studies like
    the bollinger bands?

    have a great day,

    Jaime

  • #2
    Jaime
    The syntax on how to do it depends on which Bollinger function you are using (ie ef1 or efs2).
    If you are using the efs2 function then you can retrieve historical values in two ways
    In the first method you declare the study then you use the .getValue() method to retrieve past values. For example
    PHP Code:
    var BBstudy upperBB(20,2);//declare the study
    var currentBBstudy BBstudy.getValue(0);//current value
    var prevBBStudy BBStudy.getValue(-1);//value at the prior bar
    //use (-2) for two bars ago, (-3) for three bars ago etc 
    The other method is to access the value directly as in the following example
    PHP Code:
    var currentBBStudy upperBB(20,2,0);//current value
    var prevBBStudy(20,2,-1);//value at the prior bar 
    Notice that in this second example I am not declaring the study but I am accessing the values directly by adding the barIndex parameter (ie 0, -1, etc)
    Alex

    Comment

    Working...
    X