Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90


How to prevent an Interactive Brokers "virtual entry"?

  • Filter
  • Time
  • Show
Clear All
new posts

    How to prevent an Interactive Brokers "virtual entry"?

    I run a Forex strategy on IB and today I had an order execute which said "Virtual entry"...
    All my orders are labeled and I have no "virtual" orders.
    When this happens, orders from the strategy are ignored and "sync" does nothing.
    I had to disable the strategy, and close the position manually.

    How can I prevent "virtual orders" as they are not my orders and stop strategy orders until they are cleared

    1. after closing the "virtual order", this order was not shown on the chart and orders that were supposed to execute then did show.
    2. I am using the latest gateway version 10.2 (and this never happened using version 9.81)

    Hello waltFX,

    The virtual orders are from the synchronize start behaviors. These virtual orders are submitted to make the account position match the strategy position.

    Do not use the Synchronize start behavior options to avoid virtual orders that would update the account position.
    Use 'Immediately submit' and not 'Immediately submit, synchronize account'.
    Or use 'Wait until flat' and not 'Wait until flat, synchronize account'.

    Note, synchronization orders are submitted immediately when the strategy is enabled. Meaning if a synchronize start behavior is used, the strategy must be enabled only while the market is in session, other wise the order will fail due to the market being closed.
    Chelsea B.NinjaTrader Customer Service


      Thanks but I don't think this is the case as I use the "adopt account position" option AND there were no open positions in my account.
      My strat closes all positions @11:45pm and then restarts @4am.
      The virtual trade was around 5am, with no other trades since it started @4am.
      I want to STOP any and all virtual trades as it locks my strat and requires manual closing.
      Also, looking at the history for the strat, the virtual entry was NOT included; only the manual exit.
      Again, I need to stop ALL virtual trades OR the strategy needs to be aware of the virtual position so it can be closed (not really preferred)


        Hello waltFX,

        This would also apply to Adopt Account Position which does the synchronize in reverse. The strategy gets a virtual order to allow it to match the account.

        Do not use this start behavior either if you do not want virtual orders.

        Also, the virtual orders are intended behavior. They are supposed to be there so that the synchronizing can occur. I'm not quite clear on why you are not wanting these orders.

        Further, with Adopt Account Position, your logic has to completely control the orders. Below is a link to an example.

        When using Adopt Account Position, the strategy Position.MarketPosition will be made to match the account position. It will be aware of whatever position it is synchronized to. Print the Position if you are uncertain of what position it has.
        Chelsea B.NinjaTrader Customer Service


          clearly there is a misunderstanding.

          If I have NO positions on either side, (strategy OR broker) there should be NO virtual order.

          AND when I do have a active order in the broker and I connect my strategy, the strategy adjusts to the current position WITHOUT a virtual order, which is correct.
          >>> there is no "reverse virtual" order that I can see...

          Also, if NT is aware of virtual orders, why is this order NOT in my order OR execution logs AND why does it STOP and further orders until I manually close the "virtual order"???

          My strategy runs un-attended from 4am to 11:30 pm and I don't want to have to "clean up" virtual orders in order to get things running again.

          Again, how do I turn off this newer feature because IMO it has not been thoroughly test for use with an IB Forex connection.

          NOTE: I have had a lifetime license for many years


            Hello waltFX,

            A virtual order is virtual and is not actually submitted to the broker or the strategy. It's "virtual" in that it's only there to adjust the position.

            Virtual orders do not get sent to the exchange and will not appear on the Orders tab of the Control Center and will not appear in a Trade Performance window.

            While Adopt Account Position is a newer feature, virtual orders are not a new feature and were the same in NinjaTrader 7.
            Chelsea B.NinjaTrader Customer Service



              On the chart, it displayed an order with a label "virtual order" and when I looked at my account, it had an active open position which I needed to close manually.
              When I manually closed this position, then my strategy orders started executing again.
              Here is info from IB explaining "virtual orders" (which NT is not handling correctly):


              >> Maybe I am getting IB virtual orders mixed up with NT virtual orders... still not clear; Thanks for your help although it is still "clear as mud"
              Last edited by waltFX; 02-02-2023, 06:35 AM.


                Hello waltFX,

                I am not familiar with Interactive Brokers Virtual Orders. I am only referring the virtual orders in NinjaTrader, which are not real orders, these are only position adjustments for a strategy.

                Chelsea B.NinjaTrader Customer Service


                Latest Posts


                Topics Statistics Last Post
                Started by alanlopen, 03-21-2023, 07:37 AM
                6 responses
                Last Post bltdavid  
                Started by JTizz, Today, 10:10 AM
                0 responses
                Last Post JTizz
                by JTizz
                Started by qewcool, 03-19-2023, 05:51 PM
                31 responses
                1 like
                Last Post anon84
                by anon84
                Started by BartMan, Today, 09:24 AM
                0 responses
                Last Post BartMan
                by BartMan
                Started by Lucius. valerius, 03-23-2023, 01:39 AM
                7 responses
                Last Post NinjaTrader_Ray