Thank you.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Identification of Execution Details
Collapse
X
-
Identification of Execution Details
My strategy needs to know the price, quantity and the kind of order that was executed. I understand that "execution.price" tells me the executed price and "execution.Quantity" give me the number of contracts executed, but how can I tell if the execution was for a "long entry" or a "short entry"? Perhaps the "execution.Quantity" does this by the sign of the quantity (1 = long, -1 = short). Can you straighten me out on this please?
Thank you.Tags: None
-
Hi Hcoffin,
Thank you for your post.
You can use Print(execution.Order.OrderAction) to print out the type of order that was placed, such as a Buy, Sell, Sell Short, or Buy to Cover.
Below are links on the IOrder and IExecution -
http://www.ninjatrader.com/support/h...tml?iorder.htm
http://www.ninjatrader.com/support/h...iexecution.htm
Let me know if I can be of further assistance.Cal H.NinjaTrader Customer Service
-
Clarification Please
Thank you for the quick response.
Please tell me if I am correct on the following statements:
1. OrderAction.Buy is a Long Entry Order (EnterLong)
2. OrderAction.BuyToCover is a Long Exit Order (ExitLong)
3. OrderAction.Sell is a Short Exit Order (ExitShort)
4. OrderAction.SellShort is a Short Entry Order (EnterShort)
Thank you in advance for your help.
Comment
-
Additional Question
I have attempted to create code to do what my previous question was asking about, I got the following error messages when compiling:
I set up a user-variable: private int OrderAction = 0;
Within the OnExecution() method, I entered the following:
if(execution.Order.OrderAction == OrderAction.Buy)
{
OrderAction = 1;
}
When compiling, the following error message came up:
'int' does not contain a definition for 'Buy' and no extension method 'Buy' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)
Can you see what is wrong with my code?
Thanks again,
Comment
-
Rename your variable: "OrderAction" is a reserved word.Originally posted by hcoffin View PostI have attempted to create code to do what my previous question was asking about, I got the following error messages when compiling:
I set up a user-variable: private int OrderAction = 0;
Within the OnExecution() method, I entered the following:
if(execution.Order.OrderAction == OrderAction.Buy)
{
OrderAction = 1;
}
When compiling, the following error message came up:
'int' does not contain a definition for 'Buy' and no extension method 'Buy' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)
Can you see what is wrong with my code?
Thanks again,
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
64 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
35 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
59 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment