![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
|
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]. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
You can get the average price of a position via
Position.AvgPrice - http://www.ninjatrader-support.com/H.../AvgPrice.html
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
|
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.
Last edited by Ninja in Training; 08-05-2008 at 09:34 AM.
Reason: clarification
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Your understanding is correct, it would not work.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Avg Entry Price in a Strategy | Sartis23 | SuperDOM and other Order Entry Windows | 1 | 03-28-2008 08:17 AM |
| Price Entry and EMA Close | gygraham | Strategy Development | 6 | 03-21-2008 10:06 AM |
| Price Entry and EMA Close | gygraham | Strategy Development | 0 | 03-19-2008 12:38 PM |
| capture Strategy position ENTRY by bar | Bob10 | Strategy Development | 7 | 02-09-2008 11:38 AM |
| Incorrect position entry on SIM | EuroFX | Miscellaneous Support | 12 | 09-24-2006 01:33 PM |