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 | ||
---|---|---|---|---|
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
5 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
||
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
28 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
Comment