Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
double value for entry price and int value for entry bar
Collapse
X
-
Hey Koganam
It's not that I am enamored, it's that I don't know a better way to capture the exact entry price. I could set it to the entry condition price, but that may or may not be the "actual" price. So if you had a condition: if(Flat) EnterLong(); How would you capture the entry price to a double without Position.AvgPrice, using the Managed Approach?
thanks
Comment
-
Ken,
I feel like data series is going to be overkill. If it's the price of a specific order you're looking for, I think you should switch to IOrders.
// declare separate IOrder objects
Code:private IOrder myfirstEntry = null; private IOrder mysecondEntry = null; private double entryPrice =0;
Code:if(myCondition && Position.Quantity == 0) // i've used position quantity as an alternative to checking for flat - you can do whatever you want here { myfirstEntry = EnterLong("first"); } entryPrice = myfirstEntry.AvgFillPrice;
Code:if (my condition && Position.Quantity > 0) { mysecondEntry = EnterLong("second"); }
MatthewNinjaTrader Product Management
Comment
-
Mathew
I can not used IOrders. There are internal issues with OnExecution that caused problems in my strategy that Bret was aware of but never resolved the problem. So as a consequence I do not use Advanced Managed Approach any more and I am trying to simplify my coding. Even though this also seems to have it's drawbacks.
In any event my goal remains the same to capture a single entry price value as described using Managed Approach.
Comment
-
Originally posted by kenb2004 View PostHey Koganam
It's not that I am enamored, it's that I don't know a better way to capture the exact entry price. I could set it to the entry condition price, but that may or may not be the "actual" price. So if you had a condition: if(Flat) EnterLong(); How would you capture the entry price to a double without Position.AvgPrice, using the Managed Approach?
thanks
That having been said, then just use the code I gave you, but do substitute the AvgPrice at entry. That code is already written to store that entry price in an independent double variable. IOW, for your initial entry, the AvgPrice will be the entry price. You store that in another variable, and what happens to AvgPrice after that is apropos of nothing.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by warreng86, 11-10-2020, 02:04 PM
|
6 responses
1,357 views
0 likes
|
Last Post
by mathewlo
Today, 09:34 PM
|
||
Started by Perr0Grande, Today, 08:16 PM
|
0 responses
3 views
0 likes
|
Last Post
by Perr0Grande
Today, 08:16 PM
|
||
Started by elderan, Today, 08:03 PM
|
0 responses
5 views
0 likes
|
Last Post
by elderan
Today, 08:03 PM
|
||
Started by algospoke, Today, 06:40 PM
|
0 responses
10 views
0 likes
|
Last Post
by algospoke
Today, 06:40 PM
|
||
Started by maybeimnotrader, Today, 05:46 PM
|
0 responses
14 views
0 likes
|
Last Post Today, 05:46 PM |
Comment