Announcement

Collapse
No announcement yet.

Creating series... still a mystery.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating series... still a mystery.

    This is what I had to do to create a series for high(0) - close(0) and close(0) - low(0):

    PHP Code:

    var diff1 =0;
    var 
    diff2 =0;

         if(
    xInit==false){

       
    xDiff1 =  efsInternal"fDiff"close(), low() ); 

       
    xDiff2 =  efsInternal"fDiff"high(), close() ); 
       
             
    xInit=true;

         } 
    // xInit 
          

    return new Array( xDiff1.getValue(0) , xDiff2.getValue(0) )

    function 
    fDiffy) { 
       return( eval(
    x.getValue(0) - y.getValue(0) ) ); 


    My question is why doesn't the following work:

    PHP Code:

    var diff1 =0;
    var 
    diff2 =0;

         if(
    xInit==false){

       
    xDiff1 =   close() -  low() ; 

       
    xDiff2 =  high() -  close() ; 
       
             
    xInit=true;

         } 
    // xInit 
          

    return new Array( xDiff1.getValue(0) , xDiff2.getValue(0) ) 

  • #2
    buzzhorton
    As with a Javascript array where if you apply some math to the array the result is not an array but a value (ie var myVar = myArray[0] + x does not result in myVar being an array but a single value) the same happens with a series which is an enhanced form of an array specific to eSignal.
    If you need to perform some math operations on a series and return a series you need to do them in a separate function or efs and then call them through efsInternal() or efsExternal() which will create the series.
    Alex

    Comment

    Working...
    X