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
// enters first entry and store the fill price for only that orderCode:private IOrder myfirstEntry = null; private IOrder mysecondEntry = null; private double entryPrice =0;
// allows additional entries with separate IOrder objectCode: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
-
Understood. However, if you are using Limit orders, then the price that you set as the entry price will be the entry price or better: with limit orders, only favorable slippage is possible, and to that we certainly cannot objectOriginally 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
. Are you not using Limit orders?
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 argusthome, 03-08-2026, 10:06 AM
|
0 responses
105 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
53 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
35 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
38 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
74 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment