![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Nov 2006
Location: , ,
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |