Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Target Price
Collapse
X
-
Please take a look at the code sample in post # 6. The way that I had it laid out in the prior post, we were checking for the limit price before ExitLongLimit() had returned and assigned a value to the IOrder. We just need to check to ensure the object reference is not null before trying to access its properties.Dave I.NinjaTrader Product Management
-
Originally posted by reynoldsn View PostWhen I debug this code, t=0.0 and not tgtPx - what am I doing wrong?
Code:iOrderL1 = EnterLong(iQuantity1, sENTRY1L); ExitLongLimit(tgtPx, sENTRY1L); double t = iOrderL1.LimitPrice;
If you are looking for the price at which your entry order was filled, then use OnExecution() to capture the iOrderL1.AvgFillPrice. You already know the Limit Price of your exit: you specified it as tgtPx.
Comment
-
Originally posted by reynoldsn View PostWhen I debug this code, t=0.0 and not tgtPx - what am I doing wrong?
Code:iOrderL1 = EnterLong(iQuantity1, sENTRY1L); ExitLongLimit(tgtPx, sENTRY1L); double t = iOrderL1.LimitPrice;
Thank you
Comment
-
Originally posted by reynoldsn View PostYes, I stand corrected on that. When asking for the LimitPrice, what I really want is target price of the order. I still don't have the answer.
Thank you
The target price for your exit order is the price that you specified. The target price is always the price at which you want to be filled, and has to be explicitly specified if you want to use a Limit Order. So you always have preknowledge of a target price: you specify it at where you want it to be.
You must understand the clear distinction between your entry price and your exit price. You cannot get any exit parameters from the entry order. You must specify your exit parameters: your entry price cannot contain said parameters.Last edited by koganam; 06-26-2015, 01:06 PM.
Comment
-
OK, very well said - there are some semantics going on and adjustments I need to make on my part to "think" how NinjaScript thinks.
The original question was that after an order is placed and filled, to simply be able to "query" for that order's exit (target) price. Yes, you are 100% percent correct, of course, that I specify this as an exit parameter, as you call it. But I was debugging my strategy and during market replay, orders eventually hit a target different than what I thought were specified (by me in my strategy). (not much different but still different). Thus, I want to be able to ask the order object, "what exit price are you set at?" I may have a bug somewhere so I want to check if my expected target value is in fact what the exit price is set at.
It's really no different from doing something like:
int a=8;
?a //console will show "8" , thank you for confirming that I set 'a' to 8
This is all I am really asking.
Thanks again for your time and patience
Comment
-
Originally posted by reynoldsn View PostOK, very well said - there are some semantics going on and adjustments I need to make on my part to "think" how NinjaScript thinks.
The original question was that after an order is placed and filled, to simply be able to "query" for that order's exit (target) price. Yes, you are 100% percent correct, of course, that I specify this as an exit parameter, as you call it. But I was debugging my strategy and during market replay, orders eventually hit a target different than what I thought were specified (by me in my strategy). (not much different but still different). Thus, I want to be able to ask the order object, "what exit price are you set at?" I may have a bug somewhere so I want to check if my expected target value is in fact what the exit price is set at.
It's really no different from doing something like:
int a=8;
?a //console will show "8" , thank you for confirming that I set 'a' to 8
This is all I am really asking.
Thanks again for your time and patience
So use OnExecution() to query the fill price for the exit order. That means that you are best off assigning the exit order to an IOrder, so that it is easier to query.Last edited by koganam; 06-26-2015, 02:27 PM.
Comment
-
In addition to what koganam said, here is a link that includes a code snippet that will show you exactly how to check the state of an IOrder's properties within the OnExecution() event:
http://ninjatrader.com/support/helpG...nexecution.htmDave I.NinjaTrader Product Management
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pechtri, 06-22-2023, 02:31 AM
|
9 responses
122 views
0 likes
|
Last Post Today, 02:31 PM | ||
Started by frankthearm, 04-18-2024, 09:08 AM
|
16 responses
64 views
0 likes
|
Last Post Today, 02:17 PM | ||
Started by habeebft, Today, 01:18 PM
|
1 response
5 views
0 likes
|
Last Post Today, 02:03 PM | ||
Started by benmarkal, Today, 12:52 PM
|
2 responses
13 views
0 likes
|
Last Post
by benmarkal
Today, 02:00 PM
|
||
Started by f.saeidi, Today, 01:38 PM
|
1 response
7 views
0 likes
|
Last Post Today, 01:45 PM |
Comment