Announcement

Collapse
No announcement yet.

maintaining previous bar's data when called from external efs

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

  • maintaining previous bar's data when called from external efs

    I have the following code to grab a couple of variables from an external efs. But I can't figure out how to keep the variables from the previous bar.

    var DBCall;
    var DBUpper;
    var DBLower;
    DBCall = efsExternal("DecisionBar/DecisionBarStrategy.efs", LowMA, HighMA, NumPrevPivots, 2, true, true);
    DBUpper = getSeries(DBCall, 0);
    DBLower = getSeries(DBCall, 1);

    I need DBUpper and DBLower from the current bar and the previous bar.

  • #2
    dcook
    To retrieve the values from the DBUpper and DBLower series you use the getValue() method as shown in the enclosed basic example
    Alex

    PHP Code:
    var DBCall;
    var 
    DBUpper;
    var 
    DBLower;
    DBCall efsExternal("DecisionBar/DecisionBarStrategy.efs"LowMAHighMANumPrevPivots2truetrue);
    DBUpper getSeries(DBCall0);
    DBLower getSeries(DBCall1);

    //to retrieve the values use xxx.getValue(-n) where -n is the bar index (0 is current bar, 
    //-1 prior bar, -2 two bars ago, etc)
    var currDBUpper  DBUpper.getValue(0);//current value of DBUpper
    var prevDBUpper DBUpper.getValue(-1);//previous' bar value of DBUpper
    var currDBLower  DBLower.getValue(0);//as above
    var prevDBLower DBLower.getValue(-1);//ass above
    if(currDBUpper ==null || prevDBUpper==null || currDBLower ==null || prevDBLower==null) return;//null check on the values 

    Comment

    Working...
    X