Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Checking IExecution and IExecution.IOrder
Collapse
X
-
Checking IExecution and IExecution.IOrder
Was wondering if the proper way to check the dirrection of an execution is to look at the execution.MarketPosition property? Also wondering what is the difference between execution.Quantity and execution.Order.Filled properties? TIATags: None
-
execution.MarketPosition tells you what kind of execution this is. Whether it was a buy or sell.
execution.Quantity is the quantity of the particular execution event you are processing. execution.Order.Filled is the filled amount for the order. Orders can be filled by multiple executions and execution.Order.Filled will reflect all the executions. There are implications to using execution.Order.Filled though. Since NT is multi-threaded it is possible to have race conditions where execution.Order.Filled could be greater than the total filled execution.Quantity received.Josh P.NinjaTrader Customer Service
-
Okies, one more question about advanced order handling. Is there any guarantee on order execution sequencing? For example if I have two target sell orders at different prices and the previous bar's high was lower then either order, am i guaranteed that on a succeding bar that would execute both orders that the order with the lower order will fire OnExecution first? TIA
Comment
-
After spending many hours trying to implement a single entry, multi exit system with dynamic limit orders i think i finally put something together that is robust enough to backtest with. Just to confirm what i think i've figured out so far, if you have multiple targets associated with a stop order, its your responsibilty to change the size of the stop when one of the targets is executed? Also i was wondering if there is anyway to get the BarsInProgress property associated with an IOrder? Finally do orders throw any exceptions, when something goes really wrong with an order I see a message in the log tab, but when adding try catch e.ToString() to my code these errors don't seem to throw exceptions.Last edited by darckeen; 04-15-2009, 05:59 AM.
Comment
-
darckeen,
To scale-out you have to scale-in. If you are not scaling-in the internal signal tracking will likely go out of sync. When signal tracking is intact partial fills or anything like that will automatically amend the quantities of your remaining exit orders.
There is no information on which BarsInProgress the order was submitted to, but you can use the IOrder to determine which instrument it trades on.
When an order goes haywire there is no exception thrown. The strategy will likely terminate itself after closing all open positions and cancelling all open orders.Josh P.NinjaTrader Customer Service
Comment
-
Is there anyway at all to check if an order is rejected? I've been encountering some problems when my strat submits a limit sell order bellow the bid, limit buy order above the offer, sell stop above the bid, buy stop bellow the bid. I've put in a check to modify the orders to conform to those constaints but my worry is that in the time between the adjustment and the execution the modified order could still be rejected in a fast market.
Comment
-
Yup, I just was testing my strategy having it send intentinally invalid orders and got that popup. I was my intention to handle the error myself and switch to a market order when and invalid limit/stop order is submitted and let the strategy keep running. Anyway to avoid having the strategy shutdown like this when an invalid order is submitted?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mly916, Today, 09:48 PM
|
0 responses
9 views
0 likes
|
Last Post
by mly916
Today, 09:48 PM
|
||
Started by Mikey_, Today, 09:21 PM
|
0 responses
11 views
0 likes
|
Last Post
by Mikey_
Today, 09:21 PM
|
||
Started by cre8able, Today, 05:53 PM
|
3 responses
13 views
0 likes
|
Last Post
by cre8able
Today, 09:20 PM
|
||
Started by Aryan Kumar, Today, 09:04 PM
|
0 responses
4 views
0 likes
|
Last Post
by Aryan Kumar
Today, 09:04 PM
|
||
Started by yertle, Yesterday, 05:49 PM
|
3 responses
16 views
0 likes
|
Last Post
by Mindset
Today, 08:38 PM
|
Comment