Announcement

Collapse
No announcement yet.

esignal Crash

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

  • esignal Crash

    If I include my EFS to my chart and save my settings, the next time I start esignal it crashes, however if I remove it and added it after I have loaded the esignal it is usually ok. Any reason you might think of? I use few arrays however I pop the last number whn the array length gets larger than 50.

    Thank you

    Behzad G.
    Tony Gof

  • #2
    ssample of my code

    This is a partial code for what I have. Probably it is too long of a program! THis is only partial code!

    vVolumeMASmooth1=VolumeSmooth1;
    vVolumeMASmooth2=VolumeSmooth2;





    GetDailyPivots();
    GetWeeklyPivots();


    CheckForNewBar5();
    CheckForNewBar15();

    if (vBarCounter5 > 10)
    {
    CalcMA5();
    CalcMA15();
    CalcATR5();

    /*
    CalcAngleFiftnMin();
    CalcAngleFiftnMinCurrent();
    */

    }

    /*
    if (vBarCounter5>200)
    {
    CheckForBenchMarkCandleon15();
    //CheckForBenchMarkCandleon60();
    }
    */
    if (blnGenSignal==true)
    {
    CheckForBuySignal();
    VerifyBuySignal();
    CheckForSellSignal();
    VerifySellSignal();

    /*
    CheckForTradingOpportunities();


    CheckForTrade();
    */

    }


    if (blnFirstLoad==true)
    {

    blnFirstLoad=false;
    //drawTextAbsolute(10, 50, "Enable Live Trading @URL=EFS:EnableLiveTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    drawTextPixel( 8, 100, "Enable Live Trading @URL=EFS:EnableLiveTrading", Color.red, Color.grey, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, tagId);
    tagId++;

    drawTextPixel( 8, 150, "Enable Trading @URL=EFS:EnableTrading", Color.red, Color.grey, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 8, 200, "Scale Out @URL=EFS:ScaleOutPosition", Color.red, Color.grey, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 8, 250, " Add Long @URL=EFS:AddLong", Color.red, Color.green, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New",10, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 76, 250, " Adj Long @URL=EFS:AdjLong", Color.red, Color.green, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 10, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 8, 300, "Add Short @URL=EFS:AddShort", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 10, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 76, 300, "Adj Short @URL=EFS:AdjShort", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 10, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;


    drawTextPixel( 8, 350, "Adj + .25 @URL=EFS:AdjustPriceIncrease", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 10, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 76, 350, "Adj - .25 @URL=EFS:AdjustPriceDecrease", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 10, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 8, 400, "Manage 15M @URL=EFS:Manage15M", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 8, 450, "GenSig @URL=EFS:GenSig", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;

    drawTextPixel( 76, 450, "Gen Sound @URL=EFS:GenSound", Color.red, Color.red, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, tagId);
    //drawTextAbsolute(10, 20, "Enable Trading @URL=EFS:EnableTrading", Color.RGB(0,0,255), Color.RGB(165,165,165), Text.ONTOP | Text.BOLD, null, tagId);
    tagId++;


    vMinTradeSize=vTradeSize/3;


    }






    function CheckForBuySignal()
    {


    if((MAShort5MinArray[0]<MALong5MinArray[0]) && (MAShort5MinArray[1]<MALong5MinArray[1]))
    //if (MAShort5MinArray[1]<MALong5MinArray[1])
    {
    if ((vPMAFiveMin1<vPMAFiveMin2) && ( vBuySignal5MinTagSet==false))
    //if ((MALong5MinArray[1]<vPMAFiveMin2) && ( vBuySignal5MinTagSet==false))
    {
    //debugPrintln("MA Cross UP Added");
    drawShapeRelative(0, low() - 1, Shape.UPARROW, null, Color.RGB(0,255,0), Shape.ONTOP, vBuySignal5MinTagId);
    //drawShapeRelative(0, close(), Shape.RIGHTTRIANGLE, null, Color.RGB(255,255,0), Shape.ONTOP, vBuyPointTagId);
    //debugPrintln("Buy Tag Added " + vBuySignal5MinTagId );
    vBuySignal5MinTagId++;
    vBuyPointTagId++;
    vBuySignal5MinTagSet=true;





    }

    }

    }

    function VerifyBuySignal()
    {
    CalcMA5();

    //debugPrintln("Buy Tag Removed " + vBuySignal5MinTagId );
    //if ((MALong5MinArray[1]>vPMAFiveMin2) && ( vBuySignal5MinTagSet==true))
    if ((vPMAFiveMin1>vPMAFiveMin2) && ( vBuySignal5MinTagSet==true) && (vBuySignal5MinTagId>10))
    {
    //debugPrintln("MA Cross UP Removed");
    vBuySignal5MinTagId--;
    vBuyPointTagId--;

    //debugPrintln("Buy Tag Removed " + vBuySignal5MinTagId );
    //if (vBuySignal5MinTagId>2)

    removeShape(vBuySignal5MinTagId);

    //removeShape(vBuyPointTagId);

    vBuySignal5MinTagSet=false;
    }

    }

    function CheckForSellSignal()
    {
    if((MAShort5MinArray[0]>MALong5MinArray[0]) && (MAShort5MinArray[1]>MALong5MinArray[1]))
    //if(MAShort5MinArray[1]>MALong5MinArray[1])
    {
    if ((vPMAFiveMin1>vPMAFiveMin2) && ( vSellSignal5MinTagSet==false))
    //if ((MALong5MinArray[1]>vPMAFiveMin2) && ( vSellSignal5MinTagSet==false))
    {
    //debugPrintln("MA Cross Down Added");

    drawShapeRelative(0, high() + 1, Shape.DOWNARROW, null, Color.RGB(255,0,0), Shape.ONTOP, vSellSignal5MinTagId);
    //drawShapeRelative(0, close(), Shape.RIGHTTRIANGLE, null, Color.RGB(0,255,255), Shape.ONTOP, vSellPointTagId);
    //debugPrintln("Sell Tag Added " + vSellSignal5MinTagId );
    vSellSignal5MinTagId++;
    vSellPointTagId++;
    vSellSignal5MinTagSet=true;




    }

    }








    function CalcMA5()
    {

    var vTemp1=0;

    vPMAFiveMin1 =0;
    for (var i=0 ; i<vPMASmoothFiveMin1; i++)

    {

    if (blnEMAFiveMin1==true)
    {
    vPMAFiveMin1 =vPMAFiveMin1 + offsetSeries(ema(vPMAPeriodFiveMin1,hlc3(inv(5))), vShiftMAFiveMin1 + i);
    }
    else
    {
    vPMAFiveMin1 =vPMAFiveMin1 + offsetSeries(sma(vPMAPeriodFiveMin1,hlc3(inv(5))), vShiftMAFiveMin1 + i);
    }

    }

    vPMAFiveMin1=vPMAFiveMin1/vPMASmoothFiveMin1;
    //Alert.addToList("VMPAFiveMin= "+ vPMAFiveMin1);

    // Alert.addToList("VMPAFiveMinSmoothed= "+ vPMAFiveMin1);

    vTemp1=0;

    vPMAFiveMin2=0;

    for (var i=0 ; i<vPMASmoothFiveMin2; i++)
    {
    if (blnEMAFiveMin2==true)
    {
    vPMAFiveMin2 = vPMAFiveMin2 + offsetSeries(ema(vPMAPeriodFiveMin2,hlc3(inv(5))), vShiftMAFiveMin2+i);
    }
    else
    {
    vPMAFiveMin2 = vPMAFiveMin2 + offsetSeries(sma(vPMAPeriodFiveMin2,hlc3(inv(5))), vShiftMAFiveMin2 + i);
    }

    }


    vPMAFiveMin2=vPMAFiveMin2/vPMASmoothFiveMin2;





    }








    function CheckForNewBar5()
    {
    nState5=getBarState();
    //Alert.addToList("nState5 = " + nState5);

    //debugPrintln("nState5 = " + nState5);

    if ((nState5 == BARSTATE_NEWBAR))
    {
    //debugPrintln("New 5 Min Bar");
    vBarCounter5++;

    //debugPrintln("vBarCounter = " + vBarCounter5);
    if (vBarCounter5 >10)

    {
    CalcMA15();

    ChangeTagID();


    CheckForDoji5();
    CheckForDoji10();

    //debugPrintln("New 5 Min Bar");

    if (vDoji5==true)
    {
    //drawShapeRelative(-1, low() - 1.5, Shape.UPARROW, null, Color.RGB(0,255,255), Shape.ONTOP, vDoji5TagId);
    vDoji5TagId++;
    // debugPrintln("Doji Found");

    }




    if (blnGenSignal==true)
    {
    //debugPrintln("Check for HCD-LCD");

    DetectHCD();
    DetectLCD();

    RaiseFlagForHCD();
    RaiseFlagForLCD();


    }

    if (vDoji5==true)
    vDoji5=false;

    }
    /*
    var vMinutes;
    var vSeconds;
    //myDateTime = getYear(0) + "-" + getMonth(0) + "-" + getDay(0) + " " + getHour(0) + ":" + getMinute(0) ;
    vMinutes = getMinute(0) ;
    vSeconds=getSecond(0);
    debugPrintln(myDateTime);
    */

    /***************
    insert values of vPMALong and vPMAShort into MALong15MinArrayV2 and MAShort15MinArrayV2
    */

    /////////////////////////////
    /////////////////////////////
    /////////////////////////////


    if (MALong15MinArrayV2Index>20)
    {

    MALong15MinArrayV2.pop();
    MALong15MinArrayV2.unshift(vPMAFiftnMin1);

    }

    else
    {
    MALong15MinArrayV2.unshift(vPMAFiftnMin1);
    MALong15MinArrayV2Index++;
    }


    if (MAShort15MinArrayV2Index>20)
    {

    MAShort15MinArrayV2.pop();
    MAShort15MinArrayV2.unshift(vPMAFiftnMin2);

    }

    else
    {
    MAShort15MinArrayV2.unshift(vPMAFiftnMin1);
    MAShort15MinArrayV2Index++;
    }




    ////////////////////Update MA Array/////////////

    if (MALong5MinArrayIndex>20)
    {

    MALong5MinArray.pop();
    MALong5MinArray.unshift(vPMAFiveMin1);


    }

    else
    {
    MALong5MinArray.unshift(vPMAFiveMin1);
    MALong5MinArrayIndex++;
    }


    if (MAShort5MinArrayIndex>20)
    {

    MAShort5MinArray.pop();
    MAShort5MinArray.unshift(vPMAFiveMin2);


    }

    else
    {
    MAShort5MinArray.unshift(vPMAFiveMin2);
    MAShort5MinArrayIndex++;
    }


    ////////////////////Update MA Array/////////////

    if (inTrade==true)
    {
    vNew5MinBarForTradeStatus=true;
    }


    }


    }
    Tony Gof

    Comment


    • #3
      Behzadgof,


      It is unlikely due to the code being too long, programs can be tens of thousands of lines long and still be very efficient and quite fast.

      A cursory check indicates there is a Problem at line 169 character 1: Unmatched '{'.

      This could be due to you only posting partial code. I did not check any further.

      Comment


      • #4
        Crash

        Thanks for your input. The } is not the issue. the program works fine when I add the efs after the chart has been loaded, the problem is when I first start the esignal. Also my drawtextpixel will display the buttons at first but then they will disappear.

        Is there anyway I can look at some debug files to find out what the problem might be?

        Thanks

        Ben G.
        Tony Gof

        Comment


        • #5
          You are welcome.

          To find out what is causing the issue, you may want to look back at your previous working version of the code to see what changes made it unstable. Who knows, it could be a divide by zero that is causing the problem...

          As for debug files, run a search of the forum for this term formulaoutput.log. There are several discussions related to troubleshooting, along with the location and purpose of this file that may help you.

          Without repeating too much of what is in those other posts, when you crash, open this file, perhaps the error was captured which will provide some insight.

          Comment


          • #6
            Crash

            I have limited the number of bars to 1000 using the following statement and now it does not crash, also all my controls do appear on my chart.

            if (getCurrentBarIndex() < -100 )
            return;


            My program is about 4000 lines and it uses arrays extensively. Have you seen anyone who might have had problems with arrays? I do limit the size of my arrays to 200, although before it was only 50 and still used to crash. Until I added the above statement.

            Thanks

            Ben g.
            Tony Gof

            Comment


            • #7
              Ben,

              Here is a link to a thread where I discussed a problem I was having with buffer overruns when declaring a large number of arrays as global variables using setGlobalValue().



              Assuming your arrays are declared outside main as globals you may be running into something along these lines, but that is only a guess.

              My experience indicates you can have thousands of arrays of a length of 200 and not have the issues you are describing. So I am thinking there is something else at work here either causing or contributing to the problem. While the number of lines in your efs may seem high, its size/length is minimal and has nothing to do with the problems you are having.

              If you continue to have problems, please post your entire code as per Forum Posting Guidelines (see below). This takes the guesswork out of troubleshooting (guessing at the reason for problems can become quite frustrating for all parties). You can post your code by enclosing your code as an attachment.

              Comment


              • #8
                esignal crash

                Thanks for your input, I will look into it and see if I can make it work without limiting the number of bars. I figured that an array of 200 elements should not make esignal crash!!! I have another question from you. I would like to get the RTH data on ES, and I noticed that someone had mentioned the use of ES M7=2. Is that a correct format and also does it work with getBarStateSymbol("ES #f,60"); and do I have to use it in the following format getBarStateSymbol("ES H7=2,60"). I am trying to get the values for 60 Min time frame on 5 min chart.

                Also if I want to do a back testing, how can I get the Pivot points for the time I am running my back testing for, I do have a same issue with bar Replay.

                Thanks in advance for your response.

                Ben G.
                Tony Gof

                Comment


                • #9
                  Hello Tony,

                  Regarding arrays, a size of 200 should not be a problem. If you attach your formula as Steve suggested we may be able to help uncover the specific code that is causing problems for you.

                  Yes, you can use ES M7=2 to get RTH data. It should also work with getBarStateSymbol("ES M7=2, 60"), which would be the correct syntax as well.

                  Regarding pivots for the 60 min data, one way to arrive at these calculations is by using the code from \Formulas\Pivots\PivotPointAll.efs and change the xHigh, xLow and xClose series to refer to the 60 min interval. Currently that code is using inv("D"). Try changing that to inv("ES M7=2, 60").

                  For back testing, you should then be able to refer to the pivot calculations within your conditional statements and execute the Strategy methods accordingly.
                  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


                  • #10
                    Pivot calculation in Back testing and Tick replay

                    Thanks for your input. I have been able to make my program work after limiting the number of bars to 1000.

                    You mentioned on calculating the Pivots on the tick replay, after trying that, I would need to replay the ticks at least for one day to be able to get the pivots for the second day. Then what should I do if I want to calculate the pivots for one week, should I do the same? That may not be a good solution! Also if I want to test my strategy using back testing it does not see the pivot point. I am familiar on how to calculate the pivots as well as the existing EFS for pivot point calculations, but would you have sample efs that would demonstrate on how you would calculate the pivots on tick replay or back testing scenario?

                    Thank you

                    Tony G.
                    Tony Gof

                    Comment


                    • #11
                      Calculating pivots on tick replay or backtesting

                      For pivot point calculations on the tick replay, I would need to replay the ticks at least for one day to be able to get the pivots for the second day. Then what should I do if I want to calculate the pivots for one week, should I do the same? That may not be a good solution! Also if I want to test my strategy using back testing it does not see the pivot point. I am familiar on how to calculate the pivots as well as the existing EFS for pivot point calculations, but would you have sample efs that would demonstrate on how you would calculate the pivots on tick replay or back testing scenario?

                      Thank you

                      Tony G.
                      Tony Gof

                      Comment


                      • #12
                        Tony
                        With regards to calculating pivots for Tick Replay (and/or back testing) see the solutions offered in this thread in reply to a similar question
                        Alex

                        Comment

                        Working...
                        X