Announcement

Collapse
No announcement yet.

EFS Bund orders of Dynaorder not accepted by TWS

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

  • EFS Bund orders of Dynaorder not accepted by TWS

    Hi,

    I made an efs which automatically generates orders in Trader Work Station (TWS from Interactive brokers). This efs makes use of the dynaorder host software. For most of the futures i trade the efs works fine, but for futures which needs an price format xxx.xx such as the bund fe 113.01, I get the error message from TWS stating that the price format of the order is not correct.

    Inspecting the problem further i found that the efs generates a price fe 113.00999 instead of 113.01. I use the following code:

    function buylimit (limitprice){
    rnd(limitprice,2);
    limitprice.toFixed(2);
    if (backtest ==0){
    var OID = dots5.call ("BuyLimit", symbolName, symbolType, symbolExpiry, rightInfo, strikePrice, eXchange, cUrrency, 1,limitprice);
    return (OID);
    }
    else if (backtest == 1){
    btestcounter++
    return (btestcounter);
    }
    }

    I thought that the rnd function and .toFixed(2) would correct this problem, but apparently this is not the case.

    Can please somebody help me with this problem??

    Thanks

    Ruurd H.

  • #2
    Try using the optional order types..

    in DO, there are optional order types...

    BuyLimit() - normal prices
    BuyLimitD() - type DOUBLE prices
    BuyLimitF() - type FLOAT prices

    I would suggest the "D" type orders for this - and you might try doing some price rounding for the orders (to limit the number of decimal precision).

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      does the rnd and toFixed(2) the work

      Brad

      Thanks for your response. Does the rnd and toFixed(2) the job ? or do you have another way to make sure that the format is correct ?

      I will try the double precission orderformat.

      Ruurd

      Comment


      • #4
        You are close, however, not quite the right implementation. Try this:

        limitprice = limitprice.toFixed(2)*1;

        Applying the toFixed(2) rounds to 2 decimals and converts limitprice to a string, multiplying by 1 converts back to a number.

        If you want to play around to see the difference, try this:

        debugPrintln(typeof(limitprice.toFixed(2)));

        debugPrintln(typeof((limitprice.toFixed(2)*1)));

        Comment


        • #5
          thanks for quick response

          Steve,

          Thanks I have modified the code accordingly and will test it during next week mondays session,

          Thanks again : your help is really appriciated

          Ruurd

          Comment


          • #6
            Correction:

            BuyLimit() - type FLOAT prices
            BuyLimitD() - type DOUBLE prices
            BuyLimitF() - type STRING prices in "NNN NN/NN" format, like
            "100 2/32". The space and slash delimiter are not optional.

            The "D" and "F" versions are available for all Buy/Sell functions.

            Speaking of rugosoft's problem with Bunds prices (as well as some others), some workaround for the problem is added to the version 3.02 wich I think will be published by the end of the day tomorrow (I'm finishing the documenation for it right now).

            Comment

            Working...
            X