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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
656 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
371 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment