Announcement

Collapse
No announcement yet.

Back Tester input Error

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

  • Back Tester input Error

    Hi I've come across a weird issue. I have a NUMBER input showing a BOOLEAN checkbox when I go to run it in the back tester. It works fine when applied to an advanced chart. Here is a screen cap. I've checked over and over the code. I don't see what would be causing that. I think it may be a genuine bug. Below cap is the code.




    PHP Code:
    function preMain() {
       
    /**
        *  This function is called only once, before any of the bars are loaded.
        *  Place any study or EFS configuration commands here.
        */
        
        // setComputeOnClose(); //Study needs to update on ticks for stop/targets. Enclose in barstatenewbar for onclose funcitons
                                // Right now script does some loopy stuff at 9:00 on tick replay when this is commented out.. hanis!
        
    setPriceStudy(true);
        
    setStudyTitle("Base Strategy BETA 1.96 IB!");
        
    setColorPriceBars(false);
        
    setIntervalsBackfill(true);
        
    setShowTitleParameters(false);   
        
    setCursorLabelName("Stop"0);
        
    setCursorLabelName("Target"1);
        
    setCursorLabelName("Entry"2);
        
    setDefaultBarFgColor(Color.red0);   // Stop color
        
    setDefaultBarFgColor(Color.aqua1); // Target color
        
    setDefaultBarFgColor(Color.white2);  // Entry Price    
        
    setDefaultBarThickness(20);         // Stop Thickness
        
    setDefaultBarThickness(21);         // Target Thickness
        
    setDefaultBarThickness(22);         // Entry Thickness
        
    setPlotType(PLOTTYPE_FLATLINES0);   // Stop plot type
        
    setPlotType(PLOTTYPE_FLATLINES1);   // Target plot type
        
    setPlotType(PLOTTYPE_FLATLINES2);   // Entry plot type
        


    // SET SOME USEFUL VARIALBES UP
        
    AllowTrading true
        
    symb = new String(getSymbol() );
        
    nStop 0;
        
    nTarget 0;
        
    size 0;
        
    EntryPrice 0;
        
    ExitDay 0;
        
    Lastout "green";
        
    EntryPrice 0;
        
    EntryTime 0;
        
    ExitPrice 0;  // Price last stop exited
        
    ExitTime 0;  // Time last stop executed
        
    RedCount 1;
        
    vLastAlert = -1;
        
    dcounter 1;
        
    bTargetBreach false;
        
    bInit  false;  // initialization flag
        
    closed 0;
        
    lstexec 0;  // geoff - added to count trades
        
    totlpts 0// geoff added to count total plus or minus pts
        
    trades 0// geoff
        
    dreset 1// geoff added sept 13th
        
    pnl 0;
        
               

    //  Below are the dynamic variables passed from the edit studies configure menu. 

        
        
    var gTimer = new FunctionParameter("gTimer"FunctionParameter.NUMBER);
        
    gTimer.setDefault); 
        
    gTimer.setName("Close trades after x min");  
        
        var 
    gStop = new FunctionParameter("gStop"FunctionParameter.NUMBER);
        
    gStop.setDefault(100);  // 25 Seems good
        
    gStop.setName("Hard Stop");

        var 
    gTarget = new FunctionParameter("gTarget"FunctionParameter.NUMBER);
        
    gTarget.setDefault20 ); 
        
    gTarget.setName("Profit Target 1");

        var 
    gInc = new FunctionParameter("gInc"FunctionParameter.NUMBER);
        
    gInc.setDefault100 ); 
        
    gInc.setName("Trail Stop Incriment");

        var 
    gPare1 = new FunctionParameter("gPare1"FunctionParameter.STRING);
        
    gPare1.addOption("all");
        
    gPare1.addOption("half");
        
    gPare1.addOption("keep");
        
    gPare1.addOption("3forths");
        
    gPare1.setDefault"3forths" ); 
        
    gPare1.setName("Pare out shares at target?");
        
        var 
    gBreakeven = new FunctionParameter("gBreakeven"FunctionParameter.BOOLEAN);
        
    gBreakeven.setDefaultfalse ); 
        
    gBreakeven.setName("Breakeven stop on target 1 hit? ");
        
        var 
    gOffset = new FunctionParameter("gOffset"FunctionParameter.NUMBER);
        
    gOffset.setDefault( -); 
        
    gOffset.setName("BE Offset (only if above checked)");

        var 
    gRed = new FunctionParameter("gRed"FunctionParameter.NUMBER);
        
    gRed.setDefault99 ); 
        
    gRed.setName("Cease trading at x RED trades in-a-row");
        
        var 
    gWait = new FunctionParameter("gWait"FunctionParameter.NUMBER);
        
    gWait.setDefault); 
        
    gWait.setName("Wait x min aftr STOP b4 new trade");  
        
        var 
    gAllin = new FunctionParameter("gAllin"FunctionParameter.BOOLEAN);
        
    gAllin.setDefaultfalse ); 
        
    gAllin.setName("ALL IN Strategy? (overrides above options)");
        
        var 
    gModdy = new FunctionParameter("gModdy"FunctionParameter.BOOLEAN);
        
    gModdy.setDefaultfalse ); 
        
    gModdy.setName("Modify lot size on Monday/Friday?");
          
        var 
    gDz = new FunctionParameter("gDz"FunctionParameter.BOOLEAN);
        
    gDz.setDefaultfalse ); 
        
    gDz.setName("Skip deadzone trading");
        
        var 
    gDzexit = new FunctionParameter("gDzexit"FunctionParameter.BOOLEAN);
        
    gDzexit.setDefaultfalse ); 
        
    gDzexit.setName("Exit open trades at NOON");
       
        var 
    gEOD = new FunctionParameter("gEOD"FunctionParameter.BOOLEAN);
        
    gEOD.setDefaulttrue ); 
        
    gEOD.setName("Exit trades EOD");
        
        var 
    gTest = new FunctionParameter("gTest"FunctionParameter.BOOLEAN);
        
    gTest.setDefaulttrue ); 
        
    gTest.setName("TEST MODE? (no broker trades) ");
        
        var 
    pSize = new FunctionParameter("pSize"FunctionParameter.NUMBER);
        
    pSize.setName("Default Lot Size");
        
    pSize.setLowerLimit(1);
        
    pSize.setDefault(4);
        
        var 
    gPnl = new FunctionParameter("gPnl"FunctionParameter.BOOLEAN);
        
    gPnl.setDefaulttrue ); 
        
    gPnl.setName("Show estimated P&L? ");
        
        var 
    gBT = new FunctionParameter("gBT"FunctionParameter.BOOLEAN);
        
    gBT.setDefaultfalse ); 
        
    gBT.setName("Back Tester Compability Mode?");
        
    }

    function 
    maingTimergStopgTargetgIncgPare1gBreakevengOffsetgRedgWaitgAllingModdygDzgDzexitgEODgTestpSizegPnlgBT )
     {  
    // Start beautiful block of main code 

  • #2
    Geoff
    FWIW the Boolean checkbox is not showing at my end.
    Alex

    Comment


    • #3
      Strange.. Let me reboot that PC.................... ............... .............. .............. .............. OK im back. Of course! It's not doing it now. It wasn't affecting the preformance of the script, it was just unusual.. Sorry to waste your time. Thought I'd found an actual bug. You should never see a checkbox on number input correct? I've had the PC up without rebooting for a few days so I probably hosed something up when I had that loopy code. (which is working great now..thx)

      Comment


      • #4
        Geoff
        You should never see a checkbox on number input correct?
        That is correct
        Alex

        Comment


        • #5
          Guess I'm just evil

          Comment

          Working...
          X