Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Sync with 8.0.0.12

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

    Strategy Sync with 8.0.0.12

    Are there any changes in 8.0.0.12 re.
    Sync Account Position?

    I have a strategy that on a long signal calls ExitShort + EnterLong + ExitLongLimit and on a short signal calls ExitLong + EnterShort + ExitShortLimit.

    All works ok but when re-loading the next day I'd like to synchronize it with existing positions & limit orders.

    are there any easy functions like AdoptPositions() or AdoptOrders() etc.in 8.0.0.12?

    I may have this wrong but currently it feels like I can synchronize my strategy positions whilst loosing my limit orders or re-build my strategy limit orders but not my positions?
    Last edited by delTik; 09-05-2016, 06:59 AM.

    #2
    Hello delTik, and thank you for your question. As you may be aware, the options Ninja 8 has built-in to sync account position are, as is the case with Ninja 7, designed to sync your account's position to your strategy's position. What you may have observed in that thread is that there was an at the time undocumented members Account and Account.Positions which contains a FindByInstrument method. That functionality is now documented.

    Account (has sample code)


    Account.Positions


    With this account position instrument, it may be possible during the last historical bar to sync your strategy's position to your account position. Doing so is still at this time up to the programmer.

    I have requested your vote be added for this feature. Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      ok thanks.

      With this account position instrument, it may be possible during the last historical bar to sync your strategy's position to your account position. Doing so is still at this time up to the programmer.
      do you have example code of how to add positions and stop/limit orders to a strategy so it matches the real account?

      frankly a bit surprised that this issue is so unclear or is it me?

      untested but have written this to count real position qty ...

      Code:
      		public int accountPosQty(Account ac, Instrument i)
      		{
      		   	int cnt=0;
      		   	foreach(Position position in ac.Positions)
      		    	if (position.Instrument == i)
      		      		cnt += position.Quantity;
      			return cnt;
      		}
      Last edited by delTik; 09-05-2016, 07:53 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,605 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      13 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X