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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
55 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
142 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
276 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment