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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        63 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        54 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        61 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        48 views
        0 likes
        Last Post CarlTrading  
        Working...
        X