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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        650 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        577 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X