Announcement

Collapse
No announcement yet.

Internal Error occurs when using "Show Back Test Report"

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

  • Internal Error occurs when using "Show Back Test Report"

    Dear eSignal Support Team and eSignal Community,

    I am having an issue with a Backtest I wrote that seems to work perfectly well, when I apply the strategy to a chart, but when I try to use the Chart --> Show Back Test Report function, I keep getting the following error message:

    "Internal error occurs. Try recalculate report."

    If I try to recalculate the report, the same error appears. No further explanation is offered for why this error occurs, and my code doesn't seem to be complicated at all, so I am really stuck. I would like to optimize my strategy further, but without the Back Test Report that is rather difficult.

    Below is the code of the strategy:

    Code:
    function preMain() {
        setPriceStudy(false);
        setColorPriceBars(true);
        setDefaultPriceBarColor(Color.grey);
        setStudyTitle("MA of B%");
        setCursorLabelName("vB%", 0);
        setCursorLabelName("vGD10", 1);
        setCursorLabelName("vEMA8", 2);
        setDefaultBarFgColor(Color.RGB(0xFE,0x00,0x6D), 0);
        setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 1); 
        setDefaultBarFgColor(Color.RGB(0xFE,0x69,0x00), 2);
        setDefaultBarStyle(PS_SOLID, 0);
        setDefaultBarStyle(PS_SOLID, 1);
        setDefaultBarStyle(PS_SOLID, 2);
        setDefaultBarThickness(1,0);
        setDefaultBarThickness(1,1);
        setDefaultBarThickness(1,2);
        setPlotType(PLOTTYPE_LINE,0); 
        setPlotType(PLOTTYPE_LINE,1);
        setPlotType(PLOTTYPE_LINE,2);
    }
    
    var vBollinger20_U = upperBB(20,2);
    var vBollinger20_L = lowerBB(20,2);
    var vSMA10 = sma(10);
    var vEMA8 = ema(8);
    var vSMA10_of_vBollinger20_1 = sma(10,vBollinger20_U);
    var vSMA10_of_vBollinger20_2 = sma(10,vBollinger20_L);
    var vEMA8_of_vBollinger20_1 = ema(8,vBollinger20_U);
    var vEMA8_of_vBollinger20_2 = ema(8,vBollinger20_L);
    
    function main() {
    
        if (getBarState() == BARSTATE_ALLBARS) {
                return null;
        }
    
        var vUpper = vBollinger20_U.getValue(0);
        var vLower = vBollinger20_L.getValue(0);
        var vLast = close(0);
        var vUpper_Previous = vBollinger20_U.getValue(-1);
        var vLower_Previous = vBollinger20_L.getValue(-1);
        var vLast_Previous = close(-1);
        var vSMA_Upper = vSMA10_of_vBollinger20_1.getValue(0);
        var vSMA_Lower = vSMA10_of_vBollinger20_2.getValue(0);
        var vSMA = vSMA10.getValue(0);
        var vEMA_Upper = vEMA8_of_vBollinger20_1.getValue(0);
        var vEMA_Lower = vEMA8_of_vBollinger20_2.getValue(0);
        var vEMA = vEMA8.getValue(0);
        var vB_Percent = (vLast - vLower) / (vUpper - vLower) * 100;
        var vB_Percent_Previous = (vLast_Previous - vLower_Previous) / (vUpper_Previous - vLower_Previous) * 100
        var vSMA_of_B_Percent = (vSMA - vSMA_Lower) / (vSMA_Upper - vSMA_Lower) * 100;
        var vEMA_of_B_Percent = (vEMA - vEMA_Lower) / (vEMA_Upper - vEMA_Lower) * 100;
        
        
        if (vUpper == null || vLower == null || vLast == null || vSMA_Upper == null || vSMA_Lower == null || vSMA == null || vEMA_Upper == null || vEMA_Lower == null || vEMA == null)
        return;
    
        if (Strategy.isLong() == false) {
            if ( ( (vB_Percent > vSMA_of_B_Percent) || (vB_Percent > vEMA_of_B_Percent) ) && (vB_Percent < 20) ) {
                Strategy.doLong("PercentB EMA/SMA Long Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bull Cross EMA/SMA: Bull Entry", Color.green, Color.black);
            };  
        } else if (Strategy.isLong() == true) {
            if ( (vB_Percent < vB_Percent_Previous) && (vB_Percent > 80) ) {
                Strategy.doSell("PercentB Exit Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bull Cross EMA/SMA: Exit", Color.grey, Color.black);
            };
        };
        
        if (Strategy.isShort() == false) { 
            if ( ( (vB_Percent < vSMA_of_B_Percent) || (vB_Percent < vEMA_of_B_Percent) ) && (vB_Percent > 80) ) {
                Strategy.doShort("PercentB EMA/SMA Short Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bear Cross EMA/SMA: Bear Entry", Color.red, Color.black);
            };
        } else if (Strategy.isShort() == true) {
            if ( (vB_Percent > vB_Percent_Previous) && (vB_Percent < 20) ) {
                Strategy.doCover("PercentB Cover Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bear Cross EMA/SMA: Exit", Color.grey, Color.black);
            };
        };
        
        if (Strategy.isLong()) {
            setPriceBarColor(Color.darkgreen);
        };
        if (Strategy.isShort()) {
            setPriceBarColor(Color.maroon);
        };
    
        return new Array( vB_Percent, vSMA_of_B_Percent, vEMA_of_B_Percent, 20, 80 );
    }
    Has anybody seen similar issues with Internal Errors for Back Test Reports? As the error message doesn't offer any further explanation, I am gratefuly for any help why this sort of error could appear.

    I am using eSignal On Demand version 11.6 SP2 (11.6.3167.1081 64-bit)

    Kind regards,
    panta-rhei

  • #2
    panta-rhei
    The issue is caused by the number of characters in the description of the doShort() and doCover() commands
    If these exceed 20 (or 19 I cannot remember at this time) it generates the error you are seeing. The fix at this time is to reduce the number of characters in the description to 19 or less (for example you could replace the word PercentB with %B)
    Once you make the required changes you will get the back test report
    Alex


    Originally posted by panta-rhei View Post
    Dear eSignal Support Team and eSignal Community,

    I am having an issue with a Backtest I wrote that seems to work perfectly well, when I apply the strategy to a chart, but when I try to use the Chart --> Show Back Test Report function, I keep getting the following error message:

    "Internal error occurs. Try recalculate report."

    If I try to recalculate the report, the same error appears. No further explanation is offered for why this error occurs, and my code doesn't seem to be complicated at all, so I am really stuck. I would like to optimize my strategy further, but without the Back Test Report that is rather difficult.

    Below is the code of the strategy:

    Code:
    function preMain() {
        setPriceStudy(false);
        setColorPriceBars(true);
        setDefaultPriceBarColor(Color.grey);
        setStudyTitle("MA of B%");
        setCursorLabelName("vB%", 0);
        setCursorLabelName("vGD10", 1);
        setCursorLabelName("vEMA8", 2);
        setDefaultBarFgColor(Color.RGB(0xFE,0x00,0x6D), 0);
        setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 1); 
        setDefaultBarFgColor(Color.RGB(0xFE,0x69,0x00), 2);
        setDefaultBarStyle(PS_SOLID, 0);
        setDefaultBarStyle(PS_SOLID, 1);
        setDefaultBarStyle(PS_SOLID, 2);
        setDefaultBarThickness(1,0);
        setDefaultBarThickness(1,1);
        setDefaultBarThickness(1,2);
        setPlotType(PLOTTYPE_LINE,0); 
        setPlotType(PLOTTYPE_LINE,1);
        setPlotType(PLOTTYPE_LINE,2);
    }
    
    var vBollinger20_U = upperBB(20,2);
    var vBollinger20_L = lowerBB(20,2);
    var vSMA10 = sma(10);
    var vEMA8 = ema(8);
    var vSMA10_of_vBollinger20_1 = sma(10,vBollinger20_U);
    var vSMA10_of_vBollinger20_2 = sma(10,vBollinger20_L);
    var vEMA8_of_vBollinger20_1 = ema(8,vBollinger20_U);
    var vEMA8_of_vBollinger20_2 = ema(8,vBollinger20_L);
    
    function main() {
    
        if (getBarState() == BARSTATE_ALLBARS) {
                return null;
        }
    
        var vUpper = vBollinger20_U.getValue(0);
        var vLower = vBollinger20_L.getValue(0);
        var vLast = close(0);
        var vUpper_Previous = vBollinger20_U.getValue(-1);
        var vLower_Previous = vBollinger20_L.getValue(-1);
        var vLast_Previous = close(-1);
        var vSMA_Upper = vSMA10_of_vBollinger20_1.getValue(0);
        var vSMA_Lower = vSMA10_of_vBollinger20_2.getValue(0);
        var vSMA = vSMA10.getValue(0);
        var vEMA_Upper = vEMA8_of_vBollinger20_1.getValue(0);
        var vEMA_Lower = vEMA8_of_vBollinger20_2.getValue(0);
        var vEMA = vEMA8.getValue(0);
        var vB_Percent = (vLast - vLower) / (vUpper - vLower) * 100;
        var vB_Percent_Previous = (vLast_Previous - vLower_Previous) / (vUpper_Previous - vLower_Previous) * 100
        var vSMA_of_B_Percent = (vSMA - vSMA_Lower) / (vSMA_Upper - vSMA_Lower) * 100;
        var vEMA_of_B_Percent = (vEMA - vEMA_Lower) / (vEMA_Upper - vEMA_Lower) * 100;
        
        
        if (vUpper == null || vLower == null || vLast == null || vSMA_Upper == null || vSMA_Lower == null || vSMA == null || vEMA_Upper == null || vEMA_Lower == null || vEMA == null)
        return;
    
        if (Strategy.isLong() == false) {
            if ( ( (vB_Percent > vSMA_of_B_Percent) || (vB_Percent > vEMA_of_B_Percent) ) && (vB_Percent < 20) ) {
                Strategy.doLong("PercentB EMA/SMA Long Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bull Cross EMA/SMA: Bull Entry", Color.green, Color.black);
            };  
        } else if (Strategy.isLong() == true) {
            if ( (vB_Percent < vB_Percent_Previous) && (vB_Percent > 80) ) {
                Strategy.doSell("PercentB Exit Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bull Cross EMA/SMA: Exit", Color.grey, Color.black);
            };
        };
        
        if (Strategy.isShort() == false) { 
            if ( ( (vB_Percent < vSMA_of_B_Percent) || (vB_Percent < vEMA_of_B_Percent) ) && (vB_Percent > 80) ) {
                Strategy.doShort("PercentB EMA/SMA Short Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bear Cross EMA/SMA: Bear Entry", Color.red, Color.black);
            };
        } else if (Strategy.isShort() == true) {
            if ( (vB_Percent > vB_Percent_Previous) && (vB_Percent < 20) ) {
                Strategy.doCover("PercentB Cover Signal", Strategy.MARKET, Strategy.NEXTBAR);
                Alert.addToList (getSymbol(), "B% Bear Cross EMA/SMA: Exit", Color.grey, Color.black);
            };
        };
        
        if (Strategy.isLong()) {
            setPriceBarColor(Color.darkgreen);
        };
        if (Strategy.isShort()) {
            setPriceBarColor(Color.maroon);
        };
    
        return new Array( vB_Percent, vSMA_of_B_Percent, vEMA_of_B_Percent, 20, 80 );
    }
    Has anybody seen similar issues with Internal Errors for Back Test Reports? As the error message doesn't offer any further explanation, I am gratefuly for any help why this sort of error could appear.

    I am using eSignal On Demand version 11.6 SP2 (11.6.3167.1081 64-bit)

    Kind regards,
    panta-rhei

    Comment


    • #3
      Thanks for the quick reply, Alex.

      I just tested your workaround and it works perfectly. I just wish I had used the support forum sooner, as I have spent a few hours trying to find what the problem could be. Well, lesson learned, next time I will turn to eSignal support sooner

      I also reported the bug in eSignal, I guess that ticket can be deleted if the issue is already known.

      Kind regards,
      panta-rhei

      Comment


      • #4
        panta-rhei
        You are welcome
        As to the support ticket I am not an employee of eSignal so I have nothing to do with it.
        Alex



        Originally posted by panta-rhei View Post
        Thanks for the quick reply, Alex.

        I just tested your workaround and it works perfectly. I just wish I had used the support forum sooner, as I have spent a few hours trying to find what the problem could be. Well, lesson learned, next time I will turn to eSignal support sooner

        I also reported the bug in eSignal, I guess that ticket can be deleted if the issue is already known.

        Kind regards,
        panta-rhei

        Comment

        Working...
        X