NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Educational Resources > Tips

Tips Official NinjaScript tips and tricks

Reply
 
Thread Tools Display Modes
Old 11-12-2007, 06:06 PM   #1
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default Strategy Position vs. Account Position

An important concept to understand prior to using NinjaScript strategies in a real-time trading environment (live brokerage account for example) is the difference between a Strategy Position and an Account Position. A Strategy Position is a virtual position that is created by the entry and exit executions generated by a strategy and is independent from any other running strategy’s position or an account position. An Account Position is the position you actually hold in a real-time trading account, whether it is a NinjaTrader internal simulation account (Sim101) or your live real-money brokerage account. In most cases, a trader would want their Strategy Position’s size and market direction to be equal (in sync) to their Account Position but there are situations when this may not be the case.

For example:
  • You want to run multiple strategies in the same market simultaneously where strategy A holds a LONG 1 position, strategy B holds a LONG 2 position resulting in an account that should hold a LONG 3 position in order to be in sync with both strategies
  • You want to run a strategy and at the same time trade the same market the strategy is running on using discretionary tactics through one of NinjaTrader’s advanced order entry window such as the SuperDOM or Chart Trader
An extremely common scenario…

An extremely common scenario is starting a NinjaScript strategy in the middle of a trading session, such as one hour after the session has begun. The NinjaScript strategy is run on each historical bar for the 1st hour of the session (it will actually run on all historical data loaded in a chart) to determine the current position state it would be in if it had been running live since the start of the session. This position state then becomes the Strategy Position for your strategy. Let us assume that during the historical hour your strategy would have entered a LONG 1 position and the position is still open. This would mean the Strategy Position is LONG 1 and since this trade was not actually executed on an account your Account Position is FLAT.

What can you do in this case?

If you want your Account Position to match your Strategy Position, you will need to place a manual order into the account the strategy is running on. Continuing from the above example, you would need to place a 1-lot market order for the market being traded into the account the strategy is running on.

What if I do not submit a manual order to sync my account?

The resulting behavior when the Strategy Position and Account Position are out of sync is when your strategy (continuing with the example above) closes the long position with a sell order it would bring the Strategy Position to flat and your Account Position to SHORT 1.


* Important: TD AMERITRADE Users *
When starting a NinjaScript strategy, please be absolutely sure your strategy position is in sync with your account position. It is imperative that they are in sync for your NinjaScript strategy to run properly.
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strategy: Scaling out of a position NinjaTrader_Josh Reference Samples 0 10-24-2007 12:32 AM
F account with IB showing position Shiva Swinger Miscellaneous Support 8 03-08-2006 05:02 AM
2 Position in 1 account ITVision Miscellaneous Support 2 03-07-2006 12:24 AM
Reverse Strategy / Position Torso Automated Trading 2 02-17-2006 04:21 AM
Position Strategy Fills underground Miscellaneous Support 2 06-18-2005 04:40 AM


All times are GMT -6. The time now is 02:40 AM.