Announcement

Collapse

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

Collapse

Unmanaged approach: Syncing Accounts

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

    #16
    Originally posted by NinjaTrader_ChelseaB View Post
    pstrusi,

    I agree and I am submitting a feature request to allow a strategy's virtual position and quantity manually update-able.

    Thank you for the great feedback about improving NinjaTrader.
    Chelsea, thinking about how to sync accounts automatically ( which it seems impossible from a trading Script ) I was wondering why NT is not able to execute recalculate and syncing accounts, when NT has the possibility to submit live orders outside from any Script ?
    Your feature request is great cause it really will help us a lot without disabling and re-enabling strategies, but wouldn't be even more great that it was an automated update-able ?

    Thanks for your attention

    Comment


      #17
      pstrusi,

      I am putting in a second request to have the strategy re-sync with the account when recalculating after a disconnect.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Chelsea, if that request wasn't possible to develop, maybe develop some capability of submit order from the script that don't affect the Market Position and quantity. As you know there's this snippet which allows to read the market and quantity from the broker account:
        Code:
        foreach (Account acct in Cbi.Globals.Accounts)				
        {				
        	if (acct.Positions != null && acct.Name == "Sim101")			
        	{			
        		PositionCollection positions = acct.Positions;		
        		foreach (Position pos in positions)		
        		{		
        			if (pos.Instrument.FullName == "ES 03-14")	
        			{	
        				if ( Position.MarketPosition != pos.MarketPosition || Position.Quantity = pos.Quantity)
        				{
                                            // Submit live orders outside script to sync
                                        }
        			}	
        		}		
        	}			
        }
        Knowing this we need just the capability to send live orders and all will be ok.

        Thanks once again for your kind help

        Have a Merry Christmas with your family.

        Comment


          #19
          Hi pstrusi,

          I will pass this along to our developers with your request.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_ChelseaB View Post
            pstrusi,

            Thanks for your note.

            If the strategy is out of sync due to an order that was placed by the strategy being filled while NinjaTrader was not connected, when the connection is re-established there should be an update to your strategy letting your strategy know the order has filled and should update the account as well as the strategy position.

            If the strategy is out of sync due to an external order, or an order that was not submitted by the strategy, it will not be possible to re-sync the strategy with the account. You would need to disable and then re-enable the strategy so that it does the account sync again.

            But just a thought, would it be better to have specific logic in your strategy for when the account and strategy are not in sync?
            I'm aware that this is an old post, but since I'm addressing every possible error with my Strategy, I'd like to confirm that info quote above is still actual.

            Is it enough to set "Sync Account Position = True" and "ConnectionLossHandling.KeepRunning" to be sure that in case of temporary disconnection, working orders's status, broker's position and quantity, will be synced with my running Strategy?

            Thanks

            Comment


              #21
              Hello pstrusi,

              A connection loss and resume is not quite the same as a full disconnection.

              A full disconnection would require that you manually reconnect.

              No, NinjaTrader does not poll the account or reload historical data after a connection loss is resumed.

              Yes, NinjaTrader does poll the account and reloads historical data after a disconnection and a resume.

              I have submitted a feature request to have NinjaTrader re-poll the account and re-sync a strategy after a connection is lost and then resumed.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Hi Chelsea,

                Well, I really don't get it. I've quoted what you said in an earlier post
                If the strategy is out of sync due to an order that was placed by the strategy being filled while NinjaTrader was not connected, when the connection is re-established there should be an update to your strategy letting your strategy know the order has filled and should update the account as well as the strategy position.
                In which cases will NT execute that procedure then ?

                Do you mean that NT can not sync after a short 3 minutes connection loss for example ?

                Comment


                  #23
                  Hi pstrusi,

                  I should clarify my terminology here.

                  When NinjaTrader is in a full disconnected state (not a connection loss) when the connection is re-established and the strategy re-enabled there should be an update to your strategy letting your strategy know the order has filled and should update the account as well as the strategy position.

                  (edit)
                  Used when matching the orders after the strategy restarts.
                  Last edited by NinjaTrader_ChelseaB; 10-06-2015, 02:16 PM.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    Thank you Chelsea, now I have to think how to address a connection loss
                    Last edited by pstrusi; 10-06-2015, 01:04 PM.

                    Comment


                      #25
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hi pstrusi,

                      I should clarify my terminology here.

                      When NinjaTrader is in a full disconnected state (not a connection loss) when the connection is re-established and the strategy re-enabled there should be an update to your strategy letting your strategy know the order has filled and should update the account as well as the strategy position.

                      (edit)
                      Used when matching the orders after the strategy restarts.
                      I have a doubt:
                      When NT re-establishes from a simple connection-loss, Will the Strategy or Scrip, read what's in the OnStarUp() method one again or this is just for fresh enable ?

                      Comment


                        #26
                        Hello pstrusi,

                        When re-establishing a connection from a connection loss, the strategy will not re-run OnStartUp() and will not reload historical data.

                        If disconnected and reconnected, the strategy will re-run OnStartUp and will reload historical data.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #27
                          Originally posted by NinjaTrader_ChelseaB View Post
                          Hello pstrusi,

                          When re-establishing a connection from a connection loss, the strategy will not re-run OnStartUp() and will not reload historical data.

                          If disconnected and reconnected, the strategy will re-run OnStartUp and will reload historical data.
                          Chelsea, in order to be clear about terms. When you say : If disconnected and reconnected, the strategy will re-run OnStartUp and will reload historical data you're referring to those cases when a connection-loss time is > Disconnect delay seconds, right? If so, then if I set a small DisconnectedDelaySeconds, then the Strategy will read the OnStarUp() method, won't it ?

                          Comment


                            #28
                            Hello pstrusi,

                            A full disconnection happens after a certain number of re-connection attempts within a certain amount of time. When the full disconnection happens, the script is disabled.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #29
                              Thanks Chelsea for the clarification.

                              Well, this is still a tricky area where many of us are struggling to get a minimum sync between accounts. I understand that there're many situations where logically is not possible, but I think NT could try some procedure how "poll info from your broker's account" , syncing orders.

                              I have to see how to work around this.

                              Regards

                              Comment


                                #30
                                Hello pstrusi,

                                As I have mentioned in post #17, I have put in a feature request for you to have NinjaTrader re-poll the brokerage when a temporary connection loss is experienced.

                                Are you wanting to change this request?
                                Chelsea B.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by gm7_forum, Today, 05:51 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post gm7_forum  
                                Started by cre8able, Today, 03:20 PM
                                1 response
                                9 views
                                0 likes
                                Last Post cre8able  
                                Started by fiddich, Today, 05:25 PM
                                0 responses
                                3 views
                                0 likes
                                Last Post fiddich
                                by fiddich
                                 
                                Started by gemify, 11-11-2022, 11:52 AM
                                6 responses
                                804 views
                                2 likes
                                Last Post ultls
                                by ultls
                                 
                                Started by ScottWalsh, Today, 04:52 PM
                                0 responses
                                4 views
                                0 likes
                                Last Post ScottWalsh  
                                Working...
                                X