Announcement

Collapse
No announcement yet.

efsinternal crashes esignal

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

  • efsinternal crashes esignal

    hi

    spent hours on this,

    i am trying to get a ema of avalue, i have passed it to a function via efsinternal and esignal crashes, if i remove this line all works fine
    xStudy2 = efsInternal("fEVAL",blarb1);

    Cheers

    Bob
    Attached Files

  • #2
    Hello Bob,

    The problem that your are experiencing is related to the parameter value, blarb1, that you're passing to efsInternal(). This value is changing on every bar. Each time efsInternal() is called for xStudy2 with a different number, a new xStudy2 object gets created. This process you're creating would be similar to creating a 1000 ema studies, each with a different length parameter. This is a memory killer as you have experienced.

    The solution is to use efsExternal() from a new EFS. This is the only way to turn the blarb1 calculation into a series than can then be passed to the ema() function.

    The first thing you need to do is remove all the logic where you were trying to calculate the emaval series in your original formula. Take emaval out of the return statement in main() as well. Also, the return elements that you have concatenated the +"" to prevent them from plotting needs to be removed. These returns will need to be in the form of a number and not a string.

    Now create a new formula that calls your original through efsExternal(). This allows you to use the 3rd series from that formula as the source for emaval. Your new formula can use the same preMain() code. It will also need the formula parameter logic from the original as these parameters will need to be passed to the efsExternal() call. Place your new formula in the same folder as your original. Here's a code example of what the new formula could look like. You can add back the +"" to the series that you don't want to plot from this formula if you want.

    PHP Code:
    /****************
    Description : This Indicator plots CMO (Chande Momentum Oscillator)
    Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
    ****************/
    var fpArray = new Array();
    var 
    xStudy2 null;

    function 
    preMain(){
        
    setComputeOnClose(true);
        
    setStudyTitle("SEB LinRegSlope momentum2");
        
    setCursorLabelName("Slope"0);
        
    setCursorLabelName("ZeroLine"1);
        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarFgColor(Color.cyan1);
        
    setDefaultBarFgColor(Color.blue2);
        
    setDefaultBarFgColor(Color.lime3);
        
    setDefaultBarFgColor(Color.green4);
        
    setPlotType(PLOTTYPE_HISTOGRAM2);
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("oscval"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault(3);
        }
        
    }

    function 
    main(Lengthoscval) {
        if (
    Length == nullLength 21;
        
        if (
    xStudy2 == null) {
            
    xStudy2 efsExternal("seb_linregslope[momentum].efs"Lengthoscval);
        }
        
        var 
    nRet1 getSeries(xStudy20);
        var 
    nRet3 getSeries(xStudy22);
        var 
    nRet4 getSeries(xStudy23);
        
        var 
    emavalema(9nRet30);

        
        return new Array(
    nRet10nRet3nRet4emaval);

    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


    • #3
      nice one that did the trick
      thanks jason


      Bob

      Comment


      • #4
        You're most welcome.
        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