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