offsetSeries()

ICE Data Services -

offsetSeries()
Previous  Top  Next


offsetSeries( series, offset )

New in EFS2. This function is used to offset into the past (negative offset) or into the future (positive offset). It is used primarily in conjunction with the built-in study functions. Note that the offset will be applied in the context of the interval used in the function in which offsetSeries() is running rather than in the interval used for the study that is being offset.

Parameters

series
the series to offset
offset
the positive or negative offset to apply to the series


Usage

var myStudy1 = null;
var myStudy2 = null;
var bInit = false;

function main() {
var myVar1;
var myVar2;

   
if ( bInit == false ) {
      
      
//shift the ema 10 bars into the past
      myStudy1 = offsetSeries( ema( 
20 ), -10 );

      
//shift the sma 10 bars into the future
      myStudy2 = offsetSeries( sma( 
10 ), 10 );

      bInit = 
true;

   }

   
//retrieve the current values
   myVar1 = myStudy1.getValue(
0);
   myVar2 = myStudy2.getValue(
0);

   
return new Array( myVar1, myVar2 );

}