I have a StopLoss/TrailStop strategy that sets a tight Stoploss and turns into a loose Trailstop as the price rises. The Stop Price that I use for the ExitLongStop( ) is currently based on the previous close[0] from the entry price. However, this produces bad results when the price gap up or down, so I’d like to base the stoploss price off the Position Entry Price rather than the previous Close[0].
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to return the Position Entry Price??
Collapse
X
-
How to return the Position Entry Price??
How do I return the Position Entry Price after an entry is filled?
I have a StopLoss/TrailStop strategy that sets a tight Stoploss and turns into a loose Trailstop as the price rises. The Stop Price that I use for the ExitLongStop( ) is currently based on the previous close[0] from the entry price. However, this produces bad results when the price gap up or down, so I’d like to base the stoploss price off the Position Entry Price rather than the previous Close[0].Tags: None
-
You can get the average price of a position via
Position.AvgPrice - http://www.ninjatrader-support.com/H.../AvgPrice.htmlRayNinjaTrader Customer Service
-
Thank You Ray,
Will the code below return the entry price of the Long Position??
If (Position.MarketPostion == MarketPosition.Flat)
{
If (Close[0] > Close [1]) //entry condition
{
EnterLong(1)
x = Position.AvgPrice // positon entry price
}
}
Given my current understanding NT will enter on the next BarUpdate and therefore the code will NOT work because the Long postion will not have been completed yet.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
650 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment