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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        56 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X