Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

It is possible to place duplicate orders for different accounts

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

    It is possible to place duplicate orders for different accounts

    Hi everybody! I would like to know if I can operate for two accounts at the same time with duplicated orders. I have a proprietary trade firm account and I wanted to trade simultaneously from the proprietary trade firm account and my personal account, with identical orders at the same time, replicated.

    #2
    Welcome to the forums!

    If you are proficient with C# and NinjaScript, you can certainly
    build an AddOn to do this.

    You can also try using a third-party 'trade copier', like this one.
    Last edited by bltdavid; 10-16-2020, 02:55 PM.

    Comment


      #3
      Thanks a lot, David!

      Comment


        #4
        Hello jorgeaug,

        Welcome to the forums and thank you for your post.

        I understand that you would like to submit an order to one account and have the same order submitted on a second account.

        Account-level OrderUpdate events could be used to pick up orders from one account and submit orders to another account. To accomplish this, you would need to create a script that subscribes to account-level OrderUpdate events to monitor orders sent to the first account. Then, in OnOrderUpdate you could check if an order is filled and if the order is long or short. If the order IsLong, then you can use Account.CreateOrder() to create a buy order followed by calling Account.Submit to submit that order to the second account. If the order IsShort, you could use Account.CreateOrder() to create a sell order followed by calling Account.Submit to submit that order to the second account.

        Please see the attached example script that demonstrates how this is accomplished.

        Also, please see the following help guides linked below for more information.

        OrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

        CreateOrder - https://ninjatrader.com/support/help...tegycreate.htm

        Let us know if we may further assist.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_BrandonH View Post
          Hello jorgeaug,

          Welcome to the forums and thank you for your post.

          I understand that you would like to submit an order to one account and have the same order submitted on a second account.

          Account-level OrderUpdate events could be used to pick up orders from one account and submit orders to another account. To accomplish this, you would need to create a script that subscribes to account-level OrderUpdate events to monitor orders sent to the first account. Then, in OnOrderUpdate you could check if an order is filled and if the order is long or short. If the order IsLong, then you can use Account.CreateOrder() to create a buy order followed by calling Account.Submit to submit that order to the second account. If the order IsShort, you could use Account.CreateOrder() to create a sell order followed by calling Account.Submit to submit that order to the second account.

          Please see the attached example script that demonstrates how this is accomplished.

          Also, please see the following help guides linked below for more information.

          OrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

          CreateOrder - https://ninjatrader.com/support/help...tegycreate.htm

          Let us know if we may further assist.

          hello
          thank you for the script
          i have 1 question

          the script will submit and sell order if i click on buy and also the more the more i use the script the more order this will buy for example the first time will buy 1 and sell 2 and the second time will buy 1 and sell 6 or more .

          so my question is do you know what part of the script i need to fix to make this go long or short on both the account with the same amount of contract or the same atm

          Comment


            #6
            Hello jhontorres,

            Thank you for your note.

            You may modify the OnOrderUpdate section of the previously attached example script to submit long or short orders to the second account. Currently, OnOrderUpdate checks if the position is long on account one and submits a long order on the second account for the same quantity. Also, it checks if the position of account one is short and submits a sell order to the second account for the same quantity.

            When submitting a buy order on the first account, are you seeing a sell order placed on the second account?

            Please see the video linked below which demonstrates testing the CheckOrderAcc1SubmitOrderAcc2Mod example script. When submitting a buy order to the first account, a buy order is placed for the same quantity on the second account. When placing a sell order on the first account, a sell order for the same quantity is placed on the second account.

            https://www.screencast.com/t/jbbL2vvlVZJW

            Also, here is a help guide page about OnOrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

            Please let us know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_BrandonH View Post
              Hello jhontorres,

              Thank you for your note.

              You may modify the OnOrderUpdate section of the previously attached example script to submit long or short orders to the second account. Currently, OnOrderUpdate checks if the position is long on account one and submits a long order on the second account for the same quantity. Also, it checks if the position of account one is short and submits a sell order to the second account for the same quantity.

              When submitting a buy order on the first account, are you seeing a sell order placed on the second account?

              Please see the video linked below which demonstrates testing the CheckOrderAcc1SubmitOrderAcc2Mod example script. When submitting a buy order to the first account, a buy order is placed for the same quantity on the second account. When placing a sell order on the first account, a sell order for the same quantity is placed on the second account.

              https://www.screencast.com/t/jbbL2vvlVZJW

              Also, here is a help guide page about OnOrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

              Please let us know if we may assist further.
              notice that the issue only show when i use a template

              Comment


                #8
                Hello jhontorres,

                Thank you for your note.

                The original example gives a rough outline and does not support ATM strategies. This would be possible, but you would have to ensure that you are starting a new ATM strategy for the second account with StartAtmStartegy, and the order name for the entry order must match "Entry".

                Please also note that cases for "Exit" and "Close" would need to be handled in your AddOn. The attached example can give some further direction for handling that, but this example is meant to be educational, not to be a drop-in replacement that is fully functional under all cases.

                Here is a help guide link for more information about StartATMStrategy - https://ninjatrader.com/support/help...tmstrategy.htm

                Also, here is a help guide link for more information about CloseStrategy - https://ninjatrader.com/support/help...sestrategy.htm

                Let us know if we may assist further.
                Attached Files
                Brandon H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_BrandonH View Post
                  Hello jhontorres,

                  Thank you for your note.

                  The original example gives a rough outline and does not support ATM strategies. This would be possible, but you would have to ensure that you are starting a new ATM strategy for the second account with StartAtmStartegy, and the order name for the entry order must match "Entry".

                  Please also note that cases for "Exit" and "Close" would need to be handled in your AddOn. The attached example can give some further direction for handling that, but this example is meant to be educational, not to be a drop-in replacement that is fully functional under all cases.

                  Here is a help guide link for more information about StartATMStrategy - https://ninjatrader.com/support/help...tmstrategy.htm

                  Also, here is a help guide link for more information about CloseStrategy - https://ninjatrader.com/support/help...sestrategy.htm

                  Let us know if we may assist further.
                  okay thank you
                  i will work on making on making this a addon now
                  thank you for the help

                  Comment


                    #10
                    Originally posted by NinjaTrader_BrandonH View Post
                    Hello jorgeaug,

                    Welcome to the forums and thank you for your post.

                    I understand that you would like to submit an order to one account and have the same order submitted on a second account.

                    Account-level OrderUpdate events could be used to pick up orders from one account and submit orders to another account. To accomplish this, you would need to create a script that subscribes to account-level OrderUpdate events to monitor orders sent to the first account. Then, in OnOrderUpdate you could check if an order is filled and if the order is long or short. If the order IsLong, then you can use Account.CreateOrder() to create a buy order followed by calling Account.Submit to submit that order to the second account. If the order IsShort, you could use Account.CreateOrder() to create a sell order followed by calling Account.Submit to submit that order to the second account.

                    Please see the attached example script that demonstrates how this is accomplished.

                    Also, please see the following help guides linked below for more information.

                    OrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

                    CreateOrder - https://ninjatrader.com/support/help...tegycreate.htm

                    Let us know if we may further assist.
                    Hello,
                    This skript and the later video is currently what I am looking for, thanks for that!
                    But I do have a question: How are the Orders managed after their creation? I have a Strategy that attaches TakeProfit and StopLoss Properties to my Orders, does the skript Close all open Positions when the MainAccount does?

                    Comment


                      #11
                      Hello Foxmark,

                      Thank you for your post.

                      Orders are managed in the Account update event. Please note that there is no managed approach for handling orders when using AddOn Framework.

                      Please see this help guide link for more information - https://ninjatrader.com/support/help...ount_class.htm

                      My example script from this post does not demonstrate propagating close orders and is a simple example to demonstrate how an order would be detected and then using logic, submit an order to another account.

                      Your script could use custom logic to detect an order submitted with the close button and then submit an order to close positions on another account.

                      Please let us know if we may assist further.
                      Brandon H.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by thebionukerlife, Today, 11:40 PM
                      0 responses
                      1 view
                      0 likes
                      Last Post thebionukerlife  
                      Started by KirkHammett, Today, 11:15 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post KirkHammett  
                      Started by soon123, Today, 11:12 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post soon123
                      by soon123
                       
                      Started by JustinCross, Today, 09:48 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post JustinCross  
                      Started by Unsuitable, Today, 06:30 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post Unsuitable  
                      Working...
                      X