Announcement

Collapse
No announcement yet.

cancelOrder(symbol) and closePosition(symbol) not working

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

  • cancelOrder(symbol) and closePosition(symbol) not working

    Hello Jason,

    Have you tested cancelOrder(symbol) and closePosition(symbol)?
    It seems only cancelAllOrders() and closeAllPositions() work, while the other two functions do not work. Nothing happens after calling these two functions.

    - Clearpicks

  • #2
    Hello Clearpicks,

    I have not yet tested the GB functions against the new IB bridge. I will investigate this issue within the next couple of days.
    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


    • #3
      Re: cancelOrder(symbol) and closePosition(symbol) not working

      Originally posted by clearpicks
      Hello Jason,

      Have you tested cancelOrder(symbol) and closePosition(symbol)?
      It seems only cancelAllOrders() and closeAllPositions() work, while the other two functions do not work. Nothing happens after calling these two functions.

      - Clearpicks
      I've been running with closePosition(getsymbol()) using the eSignal Paper Broker and it works fine.

      You are having problems with using this function on an IB simulated account?

      I'll check it out as that would be a problem for me also. Are you seeing any messages in the brokerage message window?

      I thought the operation of closePosition() was interesting because it looked like it closed a position in the eSignal Paper broker window by sending an offsetting trade, ie., if long 100 GOOG, it would send an order of selling 100 GOOG.

      Apparently there is some capability to query the status of a position in the eSignal Paper Broker app (which would be nice to have access to), that may not be available in IB.

      I've had other problems running my IB simulated account last night which I posted "Question on disconnect and status of old orders/positions" which perhaps you can advise me on.

      Thanks,

      Glen
      Glen Demarco
      [email protected]

      Comment


      • #4
        Re: Re: cancelOrder(symbol) and closePosition(symbol) not working

        Obviously IBBridge can attrive much more info about IB accounts than the functions have been exposed (listed in Jason's sample script) because the broker window in eSignal shows a lot of info of IB account.

        I use paper trader account and tested on futures. I could not trade stocks in my paper trader account, which is being under investigation by IB technical support.

        I am not sure whether eSignal has automatic reconnection feature. I do not think IBBridge is mature enough to be used in a 100% automatic trading script. That is the reason I am only focusing on "semi-auto" trading at this time.

        - Clearpicks


        Originally posted by demarcog
        I've been running with closePosition(getsymbol()) using the eSignal Paper Broker and it works fine.

        You are having problems with using this function on an IB simulated account?

        I'll check it out as that would be a problem for me also. Are you seeing any messages in the brokerage message window?

        I thought the operation of closePosition() was interesting because it looked like it closed a position in the eSignal Paper broker window by sending an offsetting trade, ie., if long 100 GOOG, it would send an order of selling 100 GOOG.

        Apparently there is some capability to query the status of a position in the eSignal Paper Broker app (which would be nice to have access to), that may not be available in IB.

        I've had other problems running my IB simulated account last night which I posted "Question on disconnect and status of old orders/positions" which perhaps you can advise me on.

        Thanks,

        Glen

        Comment


        • #5
          Hello Glen,

          Actually cancelOrder(symbol) works, but closePosition(symbol) does not work. I mistakenly stated cancelOrder(symbol) not working in the thread title and my previous post.

          Could you tell me on which symbol you did the test? I tried SPY, NQ H7 and AB H7, I could not close the positions in these contracts individually using closePosition(symbol).
          If your testing script works on futures, could you send me a code
          snippet? Thanks.


          - Clearpicks

          Comment


          • #6
            Originally posted by clearpicks
            Hello Glen,

            Actually cancelOrder(symbol) works, but closePosition(symbol) does not work. I mistakenly stated cancelOrder(symbol) not working in the thread title and my previous post.

            Could you tell me on which symbol you did the test? I tried SPY, NQ H7 and AB H7, I could not close the positions in these contracts individually using closePosition(symbol).
            If your testing script works on futures, could you send me a code
            snippet? Thanks.


            - Clearpicks
            Hi Mike,

            It works using the eSignal Paper Broker, for stocks, futures and currencies, (I just tested it).

            I only just started trading in my IB account using automated strategies so far only on cash currencies, and it works fine.

            I routinely use it prior to executing any trades as a precaution to insure that all positions are closed to resync my actual positions with what the EFS "thinks" are my position in the event of mismatch.

            This isn't much of a snippet but here it is hope it helps.

            PHP Code:

              
            // trigger if close is less than stop
                    
            if (close(0) <= StopPriceR &&  Realtime && etCurrentBarIndex() == )  // running realtime and short trigger 
                    
            {
                        
            closePosition(getSymbol());
                        
            sellShortMarketgetSymbol(), Size);            
                        
            StrategyisShort true;
                        
            StrategyisLong false;
                        
            StrategyisInPosition true;
                    } 
            Glen Demarco
            [email protected]

            Comment


            • #7
              Hi Glen,

              Could you check the IB TWS version and IBBridge version for me? I still can not get it work.


              - Clearpicks

              Comment


              • #8
                Originally posted by clearpicks
                Hi Glen,

                Could you check the IB TWS version and IBBridge version for me? I still can not get it work.


                - Clearpicks


                It's version 1.2.529.1342 for IB and OBCBridge, I just downloaded the plug in last week and think this is the current version.

                Verify that it works for eSignal Paper Broker to eliminate any EFS related issues?


                Can you send any orders to IB at all?

                If not then make sure you have downloaded the API and have the Configuration API-ActiveX to enabled, which I'm sure you know but I've seen it reset to default once or twice.
                Glen Demarco
                [email protected]

                Comment


                • #9
                  Hello Glen,

                  I have no problem to send orders and cancel orders. I am even able to close all positions. I just can not close the position of any specified instrument, no matter whether I use closePosition(getSymbol()) or something like closePosition("NQ H7"), etc.

                  The IB TWS I am using is build 865.7 and java version is 1.6.0.

                  The TWS API version shown in eSignal IntegratedTrading window is version 8.7.

                  The eSignal version is Build 782 and the eSignal IB Plugin version is 1.2.530.

                  I also installed TWS Interoperability Components version 9.00.

                  I think the eSignal Plugin itself contains its own set of TWS API support, therefore installing TWS Interoperability Componets is not required, right?

                  - Clearpicks

                  Comment


                  • #10
                    Originally posted by clearpicks
                    Hello Glen,

                    I have no problem to send orders and cancel orders. I am even able to close all positions. I just can not close the position of any specified instrument, no matter whether I use closePosition(getSymbol()) or something like closePosition("NQ H7"), etc.

                    The IB TWS I am using is build 865.7 and java version is 1.6.0.

                    The TWS API version shown in eSignal IntegratedTrading window is version 8.7.

                    The eSignal version is Build 782 and the eSignal IB Plugin version is 1.2.530.

                    I also installed TWS Interoperability Components version 9.00.

                    I think the eSignal Plugin itself contains its own set of TWS API support, therefore installing TWS Interoperability Componets is not required, right?

                    - Clearpicks
                    The only difference is you are running a later version of Java.

                    Is the TWS Interoperability Components the same as the API?

                    If so I am running API 9.0 and I needed it for accessing IB through another application and thought that is is not a requirement for the IB plug-in.
                    Glen Demarco
                    [email protected]

                    Comment


                    • #11
                      Hello Jason,

                      in eSignal, by clicking the menu Trade->Interactive Brokers->Interactive Brokers Info, it shows

                      Provider Name: Interactive Brokers
                      Provided Version: 1.2.529.1342
                      Requirements: Installed Workstation 4.0 and Trader Workstation ActiveX Support

                      Do I need to install a specific Active Support component or it has already been installed after I installed IBBridge Plugin? Do I need to install TWS Interoperability Compoments (found on IB website, the nest one is V9.00) ?

                      Have you ever tested IBBridge using the newest IB TWS?

                      Regards,
                      Clearpicks



                      Originally posted by demarcog
                      The only difference is you are running a later version of Java.

                      Is the TWS Interoperability Components the same as the API?

                      If so I am running API 9.0 and I needed it for accessing IB through another application and thought that is is not a requirement for the IB plug-in.

                      Comment


                      • #12
                        Hello Clearpicks,

                        Originally posted by clearpicks
                        Hello Jason,

                        in eSignal, by clicking the menu Trade->Interactive Brokers->Interactive Brokers Info, it shows

                        Provider Name: Interactive Brokers
                        Provided Version: 1.2.529.1342
                        Requirements: Installed Workstation 4.0 and Trader Workstation ActiveX Support

                        Do I need to install a specific Active Support component or it has already been installed after I installed IBBridge Plugin? Do I need to install TWS Interoperability Compoments (found on IB website, the nest one is V9.00) ?

                        Have you ever tested IBBridge using the newest IB TWS?

                        Regards,
                        Clearpicks
                        You can find the installation instructions at the
                        IB Pre-release test site. I have not installed the TWS Interoperability Components individually. However, the TWS installation may have done that.

                        All of the testing I've done this week was with the new OBCBridge 1.2.529.1342 and the latest version of TWS.
                        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

                        Working...
                        X