Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to return the Position Entry Price??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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].

    #2
    You can get the average price of a position via

    Position.AvgPrice - http://www.ninjatrader-support.com/H.../AvgPrice.html
    RayNinjaTrader Customer Service

    Comment


      #3
      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, 09:34 AM. Reason: clarification

      Comment


        #4
        Your understanding is correct, it would not work.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X