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 Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 11-30-2007, 12:23 PM   #1
OnePutt
Junior Member
 
Join Date: Nov 2006
Location: , ,
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default OnPositionUpdate Questions

When I use OnPositionUpdate I notice this method is driven twice for each event when using "live data". Historical data it is only driven once. The properties of the two events are identical so it would seem that the second one is a duplicate. I am running a 1-min ES using Zen-Fire and the strategy is SampleOnOrderUpdate where I added a PRINT statement to the OnPositionUpdate method to print all the properties.

Also, why isn't the "time" of the position change included as a property in OnPositionUpdate just like OnOrderUpdate and OnExecution?

And last, is there any practical reason to use OnPositionUpdate since OnExecution always precedes it? Or is it possible to access Position.MarketPosition from OnExecution and not be returned the correct Market Position?
OnePutt is offline  
Reply With Quote
Old 11-30-2007, 01:09 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Thanks for reporting this, I suspect it should not fire twice for each position change.

- There is no time property since in the NT core it is not relevant however, you could use DateTime.Now when the event is fired to store the time of change.

- Accessing the position property should be accurate if you call it from within OnExecution() as we internally ensure everything is in sync --> Expected behaviour. If this is not what you experience, let us know.
- Working on either method is user choice.
NinjaTrader_Ray 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
General MA questions scjohn Market Analyzer 9 04-04-2011 08:14 AM
2 Questions mazachan Strategy Development 3 09-07-2007 08:21 AM
COM interface questions. scjohn Automated Trading 1 05-17-2007 01:49 PM
A few NT6 questions miked11 Charting 2 01-14-2007 10:28 AM
Few questions MAX General Programming 8 11-16-2006 06:53 AM


All times are GMT -6. The time now is 05:46 PM.