Announcement

Collapse
No announcement yet.

Edit menu strange behaviour

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

  • Edit menu strange behaviour

    I have the following edit menu in premain. Whenever I change a value with the edit menu, the script goes lame: nothing happens but there is no error message in debugPrintln.

    If I remove the script, edit it with the (same as above) new value and load it, everything function as it should.

    Is there a limit to the number of submenus?

    Thank you in advance.

    Andrei

    var vInit = 0;
    function preMain()
    {

    if (vInit == false)
    {
    var fp1 = new FunctionParameter("s_name", FunctionParameter.STRING);
    fp1.setName("Symbol Name?");
    fp1.setDefault("ET");
    var fp2 = new FunctionParameter("s_type", FunctionParameter.STRING);
    fp2.setName("Symbol Type?");
    fp2.setDefault("FUT");
    var fp3 = new FunctionParameter("s_exp", FunctionParameter.NUMBER);
    fp3.setName("Symbol Expiry?");
    fp3.setDefault( 200403 );
    var fp4 = new FunctionParameter("s_right", FunctionParameter.NUMBER);
    fp4.setName("Put/Call Info?");
    fp4.setDefault("");
    var fp5 = new FunctionParameter("s_strike", FunctionParameter.NUMBER);
    fp5.setName("Strike Price?");
    fp5.setDefault( 0 );
    var fp6 = new FunctionParameter("s_exch", FunctionParameter.STRING);
    fp6.setName("Exchange?");
    fp6.setDefault("EUREX");
    var fp7 = new FunctionParameter("s_curr", FunctionParameter.NUMBER);
    fp7.setName("Currency?");
    fp7.setDefault("EUR");
    var fp8 = new FunctionParameter("num_contracts", FunctionParameter.NUMBER);
    fp8.setName("Lots?");
    fp8.setDefault( 3 );
    var fp9 = new FunctionParameter("profit_target", FunctionParameter.NUMBER);
    fp9.setName("Profit Target (pts)?");
    fp9.setDefault( 15.00 );
    var fp10 = new FunctionParameter("use_stop_loss", FunctionParameter.BOOLEAN);
    fp10.setName("with Stop Loss or SAR?");
    fp10.setDefault(false);
    var fp11 = new FunctionParameter("use_trailing_stop", FunctionParameter.BOOLEAN);
    fp11.setName("Trailing or Fixed Stop?");
    fp11.setDefault(false);
    var fp13 = new FunctionParameter("stop_loss", FunctionParameter.NUMBER);
    fp13.setName("Fixed Stop Loss (pts)?");
    fp13.setDefault( -8.00 );
    var fp14 = new FunctionParameter("trail_loss", FunctionParameter.NUMBER);
    fp14.setName("Trailing Stop (pts)?");
    fp14.setDefault( 8.00 );
    var fp15 = new FunctionParameter("use_limit_orders", FunctionParameter.BOOLEAN);
    fp15.setName("Use Limit/Market Orders?");
    fp15.setDefault(false);
    var fp16 = new FunctionParameter("day_open", FunctionParameter.NUMBER);
    fp16.setName("Beginning Day?");
    fp16.setLowerLimit( 0000 );
    fp16.setUpperLimit( 2400 );
    fp16.setDefault( 0004 );
    var fp17 = new FunctionParameter("day_close", FunctionParameter.NUMBER);
    fp17.setName("Ending Day?");
    fp17.setLowerLimit( 0000 );
    fp17.setUpperLimit( 2400 );
    fp17.setDefault( 828 );
    var fp18 = new FunctionParameter("daily_profit", FunctionParameter.NUMBER);
    fp18.setName("Daily Profit Target (pts)");
    fp18.setDefault(90);
    var fp19 = new FunctionParameter("daily_loss", FunctionParameter.NUMBER);
    fp19.setName("Max. Daily Loss (pts)");
    fp19.setDefault(30);
    var fp20 = new FunctionParameter("Length1", FunctionParameter.NUMBER);
    fp20.setLowerLimit(1);
    fp20.setDefault(10);
    var fp21 = new FunctionParameter("Offset1", FunctionParameter.NUMBER);
    fp21.setDefault(0);
    var fp22 = new FunctionParameter("Source1", FunctionParameter.STRING);
    fp22.setName("Source");
    fp22.addOption("Close");
    fp22.addOption("High");

    etc. up to fp27
    }
    }

  • #2
    Not sure if this is the problem, but I noticed you don't have an fp12...so it may be possible that your parameters aren't lined up as expected...

    Garth
    Garth

    Comment


    • #3
      just a thought, regarding vInit == false. Garth and I ran into something similar when we were using booleans as function parameters. On reload, the booleans went to strings. I thought it was limited to the function parameter stuff. Maybe, this is what is happening to you with vInit == false . Maybe, on reload (associated with use of the edit menu), vInit is a string. Try this

      if (vInit == false || vInit == "false")

      Comment


      • #4
        Thanks to both of you but even with your suggestions, I couldn't resolve the glitch.

        I now use arrays which is less elegant but works:

        x=0;
        aFPArray[x] = new FunctionParameter( "s_name", FunctionParameter.STRING);
        with( aFPArray[x] ) {
        setDefault( "ES" );
        }
        x++;

        Cheers.

        Andrei

        Comment

        Working...
        X