Syncing Account Positions

<< Click to Display Table of Contents >>

Navigation:  Operations > Automated Trading > Running NinjaScript Strategies >

Syncing Account Positions

Previous page Return to chapter overview Next page

Show/Hide Hidden Text

It is critical to understand the various options available to you that determine how the strategy will behave on startup through the Start Behavior parameters. NinjaTrader provides several option combinations that can be used in different scenarios depending on what your requirements are. Please first review the information about strategy position vs account positions as this article builds on that concept.


The Start Behavior settings can be set from the Strategy Parameters when you are adding a strategy.


Note: Please be aware that these options will only help you sync your Account Position to your Strategy Position once on startup. These options will not guarantee your Account Position remains in sync afterward. Any active orders you may have had on your account prior to strategy start that was not generated by your strategy would not have been cancelled on start and can lead to your Account Position being out of sync from your Strategy Position. Placing manual trades or running multiple strategies on the same instrument can also lead to your Account Position being out of sync from your Strategy Position.



Using Synchronize account can close or place live trades to your account

If you have existing historical order references which have transitioned to real-time, you MUST update the order object reference to the newly submitted real-time order; otherwise errors may occur as you attempt to cancel the order.  You may use the GetRealtimeOrder() helper method to assist in this transition.


tog_minus        Wait until flat

tog_minus        Wait until flat, synchronize account

tog_minus        Immediately submit

tog_minus        Immediately submit, synchronize account

tog_minus        Adopt account position

tog_minus        Synchronize all strategies