Announcement

Collapse
No announcement yet.

Esignal crashing when loading efs

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

  • Esignal crashing when loading efs

    Hi,

    I have written an efs that works off sma crosovers and pivots through an external efs.

    The pivot efs works fine on all charts as does the sma crossover (without the efs(external) and all consequential formulas) but when this efs is loaded in anything more then a 14day timetemplate it causes esignal to crash.

    Any ideas as to what needs changing would be greatly appreciated.

    Thanks in advance

    Min

    Code is as follows:
    PHP Code:
    var vSMA5 = new MAStudy(50"Close"MAStudy.SIMPLE);
    var 
    vSMA15 = new MAStudy(150"Close"MAStudy.SIMPLE);
    var 
    vUpTrend null;
    var 
    vDownTrend null;
    var 
    vValue = -1;
    var 
    Target null;
    var 
    Stop null;
    null;
    null;
    var 
    vTradeOk false;

    function 
    preMain() {
    //{{EFSWizard_PreMain
        
    setPriceStudy(true);
        
    setStudyTitle("Set Profit and Stop 24hr & Pivots");
        
    setCursorLabelName("5MA"14);
        
    setCursorLabelName("15MA"15);
        
    setDefaultBarFgColor(Color.maroon14);
        
    setDefaultBarFgColor(Color.teal15);
        
    setPlotType(PLOTTYPE_LINE14);
        
    setPlotType(PLOTTYPE_LINE15);
        
    setDefaultBarStyle(PS_SOLID14);
        
    setDefaultBarStyle(PS_SOLID15);
        
    setDefaultBarThickness(214);
        
    setDefaultBarThickness(215);
        
    setComputeOnClose(true)
        
    //}}EFSWizard_PreMain
    }

    debugClear()
    function 
    main() { 

    myVar sma); 
    myVar 2.5;
    myVar -2.5;    

    var 
    xExample null;
    var 
    myR1 null
    var 
    myR2 null
    var 
    myR3 null
    var 
    myR4 null
    var 
    myPP null
    var 
    myS1 null
    var 
    myS2 null
    var 
    myS3 null
    var 
    myS4 null;
    var 
    myPH null
    var 
    myPL null
    var 
    myGap null
    var 
    myTH null;
    var 
    myTL null
    var 
    bInit false


    if ( 
    bInit == false ) { 
    xExample efsExternal("Pivots.efs"); 
            
            
    bInit true;         
        } 
    if (
    xExample != null) {

            if (
    myR4 == nullmyR4 getSeries(xExample0); 
            
            if (
    myR3 == nullmyR3 getSeries(xExample1); 
           
            if (
    myR2 == nullmyR2 getSeries(xExample2); 
            
            if (
    myR1 == nullmyR1 getSeries(xExample3); 
            
            if (
    myPP == nullmyPP getSeries(xExample4); 
            
            if (
    myS1 == nullmyS1 getSeries(xExample5);  
           
            if (
    myS2 == nullmyS2 getSeries(xExample6); 
            
            if (
    myS3 == nullmyS3 getSeries(xExample7); 
            
            if (
    myS4 == nullmyS4 getSeries(xExample8);
           
            if (
    myPH == nullmyPH getSeries(xExample9); 
           
            if (
    myPL == nullmyPL getSeries(xExample10); 
            
            if (
    myGap == nullmyGap getSeries(xExample11);
            
            if (
    myTH == nullmyTH getSeries(xExample12);
            
            if (
    myTL == nullmyTL getSeries(xExample13);
        }
    if (
    vSMA5.getValue(MAStudy.MA) < vSMA15.getValue(MAStudy.MA) && 
        (
    vValue != 1)) { 
        
    onAction3()
    }            
    if (
    vSMA5.getValue(MAStudy.MA) > vSMA15.getValue(MAStudy.MA) && 
        (
    vValue != 2)) {
        
    onAction4()
    }
    if  (
    getBarState()==BARSTATE_NEWBAR) { 
    if (
    myR4 high(0) && myR4 low(0) || 
        
    myR3 high(0) && myR3 low(0) ||
        
    myR2 high(0) && myR2 low(0) || 
        
    myR1 high(0) && myR1 low(0) ||
        
    myPP high(0) && myPP low(0) || 
        
    myS1 high(0) && myS1 low(0) || 
        
    myS2 high(0) && myS2 low(0) || 
        
    myS3 high(0) && myS3 low(0) ||
        
    myS4 high(0) && myS4 low(0) || 
        
    myGap high(0) && myGap  low(0) )
        {
    vTradeOk false;}
    else {
    vTradeOk true;} }
    if  (
    getBarState()==BARSTATE_NEWBAR) {
        if  (
    vSMA5.getValue(MAStudy.MA) < vSMA15.getValue(MAStudy.MA) && 
            
    vSMA5.getValue(MAStudy.MA, -1) > vDownTrend &&
            
    vSMA5.getValue(MAStudy.MA) < vDownTrend &&
            
    vTradeOk == &&
            
    Strategy.isShort()==false) {
            
    Alert.playSound("Money");
            
    Target close(0) -6
            Stop 
    close(0) +6
            Strategy
    .doShort("Short",Strategy.CLOSE,Strategy.THISBAR)
            
    drawShapeRelative(0high(-2), Shape.DOWNARROW""Color.blueShape.BOTTOM);
    } }
    if  (
    Strategy.isShort()==true) {
        if (
    low(0)<=Target) {
        
    Strategy.doCover("Cover",Strategy.STOP,Strategy.THISBAR,null,Target);
    }
        if (
    high(0)>=Stop){
        
    Strategy.doCover("Cover",Strategy.STOP,Strategy.THISBAR,null,Stop);
        
    drawShapeRelative(0high(-2), Shape.DOWNARROW""Color.blackShape.BOTTOM);
    }   }
    if (
    getBarState()==BARSTATE_NEWBAR) {
        if (
    vSMA5.getValue(MAStudy.MA) > vSMA15.getValue(MAStudy.MA) &&
        
    vSMA5.getValue(MAStudy.MA, -1) < vUpTrend &&
        
    vSMA5.getValue(MAStudy.MA) > vUpTrend &&
        
    vTradeOk == &&
        
    Strategy.isLong()==false) {
        
    Alert.playSound("Money");
        
    Target close(0) +6
        Stop 
    close(0) -6
        Strategy
    .doLong("Long"Strategy.CLOSEStrategy.THISBAR)
        
    drawShapeRelative(0low(-2), Shape.UPARROW""Color.purpleShape.TOP);
    } }
    if (
    Strategy.isLong()==true) {
        if (
    high(0)>=Target) {
        
    Strategy.doSell("Sell",Strategy.STOP,Strategy.THISBAR,null,Target);
    }
        if (
    low(0)<=Stop) {
        
    Strategy.doSell("Sell",Strategy.STOP,Strategy.THISBAR,null,Stop);
        
    drawShapeRelative(0low(-2), Shape.UPARROW""Color.blackShape.TOP);
    } }

    return new Array(
        
    myR4 ,myR3myR2myR1myPPmyS1myS2myS3myS4myPHmyPLmyGapmyTHmyTL,
        
    vSMA5.getValue(MAStudy.MA),
        
    vSMA15.getValue(MAStudy.MA)
      );
    }
     
    //{{Action_3
    function onAction3() {
       
    // drawShapeRelative(0, high(-2), Shape.DOWNARROW, "", Color.RGB(255,0,0), Shape.BOTTOM); 
       // debugPrintln("y= " + y);
        
    Alert.playSound"C:\Program Files\eSignal\Sounds\Warning" );
        
    drawLineRelative(0, (y), +25, (y), PS_SOLID2Color.redgetValue("RawTime") + "xdownpt");
        
    vDownTrend y;
       
    // debugPrintln("DownTrend = " + vDownTrend);
        
    vValue 1;
    }
    //{{Action_4
    function onAction4() {
       
    // drawShapeRelative(0, low(-2), Shape.UPARROW, "", Color.RGB(0,255,0), Shape.TOP);
       // debugPrintln("x= " + x);
        
    Alert.playSound("C:\Program Files\eSignal\Sounds\Warning");
        
    drawLineRelative(0, (x), +25, (x), PS_SOLID2Color.greengetValue("RawTime") + "xuppt");
        
    vUpTrend x;
       
    // debugPrintln("UpTrend = " + vUpTrend);
        
    vValue 2;


  • #2
    Hello Min,

    Please also post the version of Pivots.efs that you're using with the efsExternal() call.
    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
      Jason K

      I have attached the Pivot formula.

      Thanks

      Min
      Attached Files

      Comment


      • #4
        Min
        FWIW I ran your script on a chart set to load 120 days of 1 minute data (for a total of more than 160,000 bars) and the script appears to be working using version 10.2 build 1391 (see enclosed screenshot)
        Alex

        Comment


        • #5
          Alexis

          I was using version 10.1 but just upgraded and now all seems fine
          This version is much faster then the last one

          Thanks

          Min

          Comment


          • #6
            Min
            You are welcome and I am glad to hear that it is now working
            I agree that version 10.2 is considerably faster
            Alex


            Originally posted by Min
            Alexis

            I was using version 10.1 but just upgraded and now all seems fine
            This version is much faster then the last one

            Thanks

            Min

            Comment

            Working...
            X