Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to submit an order for a specific account

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

    How to submit an order for a specific account

    In the strategy I can use EnterLong or EnterShort method to place an order for the active account associated with the strategy. On the event OnExecutionUpdate, I place another order for a different account with code anotherAccount.CreateOrder(), then anotherAccount.Submit(). However, that code does not work as expected. NinjaTrader shows up popup message "Sim101, Order 'xxx' can't be submitted. Exceeds instruments maximum position quantity...". The Orders tab also shows those orders are rejected.

    This is how I want to write my copy trade code. OnExecutionUpdate event of a strategy will create a same order for another account. But it does not work. Is there a way to execute an order for any specific account, not the active account?

    Thank you!
    Last edited by excelxp; 02-09-2022, 10:52 PM.

    #2
    A strategy is associated with a single account, chosen when
    the strategy is started.

    If you want to submit orders for two different accounts, start
    the strategy in both accounts, or use a trade copier.

    Comment


      #3
      Thank you for your answer. It is not what I want to do as I am writing a trade copier by myself, not want to use any trader copier plugin. My trade copier does not copy orders but to copy executions which are completed orders, not ongoing orders.

      If there is code to execute an order for any account within a strategy, it would be help. My code inside OnExecutionEvent event does not work when I use anotherAccount.CreateOrder(), then anotherAccount.Submit()

      Comment


        #4
        Maybe don't use a Strategy, have you tried either an Indicator or an Addon?

        Comment


          #5
          Hello excelxp,

          In general for what you are asking it would suggested to use a indicator or addon which is account neutral, then you would add all the accounts you wanted to use in code. You could use the addon framework within a strategy however in that context you would have to develop two separate sets of logic, one for the strategy side using strategy methods/properties/events and one for the addon side.


          Comment


            #6
            Hi Jesse, your solution sounds good for me. I will separate two sets of logic.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            559 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            546 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X