Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to access the ExitPrice of the last position?

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

    How to access the ExitPrice of the last position?

    Hello,

    how can I access the ExitPrice of a position? For the Entry I´m using
    "Position.AvgPrice" which works fine. But I can´t find a function for the ExitPrice.


    Thanks a lot.


    Joerg

    #2
    Joerg,

    You can access it from the Trade class. http://www.ninjatrader-support.com/H...radeClass.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      I´m trying to send mails after every execution with information of the execution price and the actual market position. At the moment I´m using the following code but on every closing execution I get the mail for LongEntry or ShortEntry but never for the FlatPosition. What do I wrong?

      Thanks a lot.

      Joerg


      ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++

      protected override void OnExecution(IExecution execution)
      {

      if (execution.MarketPosition == MarketPosition.Long)
      {
      SendMail("[email protected]", "[email protected]", "Execution","LongEntry @ " + execution.Price);
      }
      if (execution.MarketPosition == MarketPosition.Short)
      {
      SendMail("[email protected]", "[email protected]", "Execution","ShortEntry @ " + execution.Price);
      }
      if ((execution.MarketPosition != MarketPosition.Short) &
      (execution.MarketPosition != MarketPosition.Long) )
      {
      SendMail("[email protected]", "[email protected]", "Execution","Flat @ " + execution.Price);
      }

      Comment


        #4
        Hello,

        I believe this is happening because the market postion of the exection is niether long or short. Try using: if long, if short, else send email.

        Post another reply if that doesn't work and I'll have josh take a look at it for you.
        DenNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        661 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        375 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 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
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X