Announcement

Collapse
No announcement yet.

SymbolCompareAsNPS2.efs

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

  • SymbolCompareAsNPS2.efs

    is there a way i can adapt this
    what im trying to do is have an offset
    the example
    im trying to compare one year to another
    say indu compare to indu only i want the comparison
    like 940 weeks moved forward .
    any ideas on that ????

  • #2
    Hello jlongwill,

    A 940 week offset may exceed our historical data depending on the symbol/interval. However, adding an offset can easily be done with EFS2's offsetSeries() function. Wrap the open, high, low and close calls starting at line 99 with the offsetSeries() function like below.

    PHP Code:
    var offsetSeries(open(sym(vSym)), nOffset);
    var 
    offsetSeries(high(sym(vSym)), nOffset);
    var 
    offsetSeries(low(sym(vSym)), nOffset);
    var 
    offsetSeries(close(sym(vSym)), nOffset); 
    The nOffset variable can be established as a hard coded value, or you could add it to the other functions parameters in preMain using the
    FunctionParameter Object. Here's an example of what to add to preMain for the nOffset parameter.

    PHP Code:
            var fp2b = new FunctionParameter("nOffset"FunctionParameter.NUMBER);
                
    fp2b.setName("Offset");
                
    fp2b.setLowerLimit(0);        
                
    fp2b.setDefault(0); 
    The only other thing you would need to do is add nOffset to main()'s parameters like below.

    PHP Code:
    function main(Symbol1NumBarsnOffsetBarThicknessUcolorNcolorDcolor) { 
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X