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 | ||
---|---|---|---|---|
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
14 responses
1,789 views
0 likes
|
Last Post
by aligator
Today, 11:47 AM
|
||
Started by Jimmyk, 01-26-2018, 05:19 AM
|
6 responses
837 views
0 likes
|
Last Post
by emuns
Today, 11:27 AM
|
||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
6 responses
3,293 views
1 like
|
Last Post
by jgualdronc
Today, 10:56 AM
|
||
Started by Touch-Ups, Today, 10:36 AM
|
0 responses
13 views
0 likes
|
Last Post
by Touch-Ups
Today, 10:36 AM
|
||
Started by geddyisodin, 04-25-2024, 05:20 AM
|
11 responses
63 views
0 likes
|
Last Post Today, 10:08 AM |
Comment