![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Hi,
I believe I know the answer to this question, but just wanted to double check. If OnExecution is called on a partial fill of an order... then the IOrder.token will match my initial token returned from the original order call, correct? For every "partial fill" going into OnExecution? |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Yes. Watching underlying IOrder object from the OnExecution can pose race conditions as well. For instance, if you have partial fills and are receiving OnExecution events. Let us say you had 3 part fills. On your second execution if you checked IOrder for order status you can easily get a returned state of Filled even though you have not received all 3 of the execution events yet.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Quote:
As always, appreciate the quick response. In your example, I'm still guaranteed to get all 3 calls into OnExecution... correct? I just can't rely on IOrder having the right status? If so, I'll just calculate the number of shares actually sold/bought based on the field in IExecution, which I assume is always correct... And in the case of TDAmeritrade (as discussed in the autotrading forum)... it doesn't matter, because IOrder returns filled for partial fills in any case. |
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
That would be the way to go.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OnExecution(IExecution execution) stop loss | Czarek | Strategy Development | 25 | 08-26-2008 12:14 PM |
| OnExecution Method | mjuviler | Strategy Development | 6 | 08-06-2008 11:32 PM |
| OnExecution Ref Sample Not Working | mjuviler | Strategy Development | 8 | 05-19-2008 07:37 AM |
| Strategy: Using OnOrderUpdate() and OnExecution() methods to submit protective orders | NinjaTrader_Josh | Reference Samples | 0 | 05-08-2008 01:42 AM |