Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ExitLong doesn't show P&L

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

    ExitLong doesn't show P&L

    When I go long with an EnterLong(), then have the trade appreciate, and then do an ExitLong(), I see a "Buy to cover" on the chart, but my P&L dissapears and it looks as if the original trade was never made.

    Am I closing out the position incorrectly? P&L is there until I do the ExitLong(). I have tried passing nothing and passing the signalName but the strategy tab shows no realized or unrealized profit once I make this call.

    #2
    PnL dissapears from where?
    RayNinjaTrader Customer Service

    Comment


      #3
      Sorry, should have been more clear, if you look in the strategy tab, when the order is long and above water, the unrealized gains show up. As soon as you close the position using ExitLong(), the unrealized gains goes to zero and realized gains does not increase, it remains at zero.

      Comment


        #4
        Once the trade is closed, right click in your strategy, select Strategy Performance > Real-Time.

        You will see the closed trade in the trades tab along with the executions. Likely this last trade had PnL of zero?
        RayNinjaTrader Customer Service

        Comment


          #5
          Shouldn't the realized gains show up in the strategies tab? It does when I close out orders using other methods. And in the cases I am talking about, the PnL on the trade was positive. I will try to look at the performance by right clicking, but something is wrong here, I know its supposed to update that row in the strategies tab in real time. It does when the position is open, but as soon as I close a position (that was created originally as a market order) with ExitLong("signalName") or ExitLong(), the value goes back to zero.

          I think something else is up here, thanks for the help but does anyone have any additional ideas?

          Comment


            #6
            Would it be possible for someone to try to reproduce this? Just create a strategy through ninja script that EnterLong() market order, then wait until its a few points above and ExitLong(). Watch the strategy tab in the control center. See how the unrealized gains fluctuates as the price of the instrument fluctuates? Once you ExitLong(), does the realized gains update at all?

            Comment


              #7
              Did you check the performance? Was the trade PnL zero?
              RayNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Ray View Post
                Did you check the performance? Was the trade PnL zero?
                I'm not going to be at my desk until later this evening. Any way you can try to repro this and tell me if its normal for it to show up in the performance but not in the regular row displayed in the strategies tab? Maybe that row is only for open orders?

                Comment


                  #9
                  I've got the same problem, although the PnL is reported correctly in the MarketAnalyser (but not the position and the unrealized PnL which are reported correclty in the strategy performance tab!).

                  Comment


                    #10
                    Originally posted by ryker View Post
                    I've got the same problem, although the PnL is reported correctly in the MarketAnalyser (but not the position and the unrealized PnL which are reported correclty in the strategy performance tab!).
                    Wow, ok then it's not just me. That definitely doesn't seem right. It makes it very hard to monitor multiple strategies in real time if you have to check each one through the strategy performance by right clicking on it.

                    Ryker, when you say strategy tab performance you don't mean the tab with strategies in the control center right?

                    Comment


                      #11
                      I meant in the strategy tab in the control center (where you start each strategy). Did you mean something different?

                      Comment


                        #12
                        Originally posted by ryker View Post
                        I meant in the strategy tab in the control center (where you start each strategy). Did you mean something different?
                        That's what I meant too, in so far as that is where it is *not* being updated.

                        Comment


                          #13
                          Lets not confuse things here, two different things.

                          tradefaz, I have tried it here and it works as expected. Please following instructions in prior posts.

                          ryker,
                          PnL in MA displays account based PnL, strategy reports strategy based PnL. They are not one to one relationship. I suspect you likely have seen this before but in case you have not, this might be of value - http://www.ninjatrader-support.com/v...ead.php?t=4033
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Ray View Post
                            Lets not confuse things here, two different things.

                            tradefaz, I have tried it here and it works as expected. Please following instructions in prior posts.

                            ryker,
                            PnL in MA displays account based PnL, strategy reports strategy based PnL. They are not one to one relationship. I suspect you likely have seen this before but in case you have not, this might be of value - http://www.ninjatrader-support.com/v...ead.php?t=4033
                            Ok now I am confused. Are you saying that after closing out a winning long order from a strategy, that the realized gains column on the row for that strategy in the strategy tab (not the strategy performance window which is right click to get to) will show the new realized gains for that strategy?

                            Because if that is what you're able to do I am not able to. But if you're saying that its not supposed to show realized gains after a position is closed within a strategy, and that column is purely for displaying unrealized gains on open positions, then I guess its doing what its supposed to do.

                            Sorry for all the confusion, its a bit difficult to explain all this in writing.

                            EDIT: I should stop saying realized P&L, i mean realized gains column, sorry.
                            Last edited by tradefaz; 08-21-2008, 12:17 PM.

                            Comment


                              #15
                              Ray,
                              I'm aware of what you say, but both of them should show the same numbers in realized if you trade a strategy on just a symbol and don't trade this symbol anywhere else.
                              Anyway realized column is not populated in strategy tab (or stays at 0), unrealized sometimes stays at 0 and is sometimes populated (I mean when I'm in position).

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              436 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post FAQtrader  
                              Started by rocketman7, Today, 09:41 AM
                              5 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by frslvr, 04-11-2024, 07:26 AM
                              9 responses
                              127 views
                              1 like
                              Last Post caryc123  
                              Working...
                              X