Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Realized Profit Issues While In Trade

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

    #16
    To be clear,

    what is out of sync with what?
    RayNinjaTrader Customer Service

    Comment


      #17
      right now I have paused the strategy at 10:25 am.

      The output window realized Pnl that I print using the print statement says "$220"

      The Stratigies Tab Realized Pnl says $90.00

      Mark

      I don't need to run this on live data as my full strategy runs every day with real money and I see the problem every day.

      This tiny strategy I did should expose the error for your developers to debug.

      Comment


        #18
        Got it.

        Will follow up later with further instructions.
        RayNinjaTrader Customer Service

        Comment


          #19
          Please mail me to "dierk AT ninjatrader DOT com":
          a) you simple as possible strategy
          b) the zipped replay files for the instrument in question (see <NinjaTrader 6.5>/db/data/<date>)
          c) any relevant info to reproduce the issue
          d) which date are you replaying?

          Thanks

          Comment


            #20
            I sent the email as you requested..........

            Comment


              #21
              This is a bug on the strategies grid which will fixed with next update. For now just rely on what have coded in your strategy.

              Thanks for reporting and for providing the detailed info.

              Comment


                #22
                Dierk,

                Are you positive that is all there is to the issue? Because, I am pretty sure that the PnL numbers within my strategy don't acurately reflect the actual account position Realized and unrealized PnL from my broker while in a trade in the strategy.

                The main issue for me is I need an actual Realized PnL + Unrealized PnL to stop trading if I am off more than x dollars in the account for the strategy. It is an account issue (not a grid issue).

                So if realized is 300 and unrealized is 400 then the loss is 700 right now (in the middle of a trade) and I need to stop trading, close positions and turn off the system immediately. So while my strategy thinks it has a $700 dollar loss the loss could be $900. Or the Strategy may think the profit is $1,000 but the actual profit reported by the broker is $1,300. I know I have seen this as well.

                My concern is that the functions for PnL within my strategy are not reflective of the actual account status for that day, trading live from the Strategy.

                Can you assure me that the functions within the strategy are acurately reflecting the account position?

                Thanks....

                Mark

                Comment


                  #23
                  Realized PnL in the strategy ONLY is reflective of PnL related to positions managed by the strategy and NOT to account PnL.

                  Unfortunately there is no way you could sync your strategy to the account PnL.

                  Comment


                    #24
                    Yes, but if all you are running is the strategy (nothing else) for that day, then they should match (or be really really close)

                    All I run is the Strategy. Nothing else.

                    No other trades are placed with the broker outside the Strategy.

                    Mark

                    Comment


                      #25
                      BTW, I am not complaining, I think what you guys at Ninja have done with Strategy Development and the features of the product are awesome.

                      I love the event based order handling, compliled C# code, etc.

                      Real very nice!!!!

                      I am just trying to work out a couple of kinks in my Strategies. I work for a company that builds and implements automated trading strategies and we have settled on Ninja as a platform to implement them connected to institutional grade pipe to the exchange which your product makes sooo easy.

                      Thanks to you and all the Ninja people for a great product and the attentive support....

                      Mark

                      Comment


                        #26
                        More Unrealized PnL Issues

                        I correctly identified two bugs that you fixed in your last release. Thanks for fixing them! I think you can trust me in identifying them.

                        I am still having problems with Unrealized PnL calculations while in a trade. This is manifested in the DOm as well as the PnL functions in my strategies.

                        Problem 1:

                        My PnL in the strategy Tab shows $48.00 and the Dom shows $-119214.26 while the strategy is short 1 yen.

                        Problem 2:

                        You are not calculating Open profit coorectly using this code when using matching entry and exit orders. As I have indicted in this thread you might be using the inncorrect FIFO instead of LIFO as I indicated in this thread:

                        CurUnRealizedProfitLoss = Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);

                        Comment


                          #27
                          #1: Please provide a reproducible scenario in order to analyze.
                          #2: There is no FIFO/LIFO logic whatsoever on open profit calculations. Just the difference between the avg position price and the current market price.

                          Comment


                            #28
                            See below:

                            #1: Please provide a reproducible scenario in order to analyze.

                            Ok, can I send screen shots anywhere

                            #2: There is no FIFO/LIFO logic whatsoever on open profit calculations. Just the difference between the avg position price and the current market price.

                            Correct me if I am wrong but the average entry price is determined by FIFO and LIFO or scaled entries and exits, right?

                            For instance:

                            Say I enter 1 long at 10 order a
                            Then I enter 1 long at 20 order b
                            Then I enter 1 long at 30 order c

                            Ok, so I am long 3

                            Then I sell 1 at 40 from order c (LIFO)

                            Now I am long 2

                            If LIFO then the Average price of the open position (long 2 Order A and B) is 15

                            If FIFO then the Average entry price (long 2 Order B and C) would by 25 or something

                            It clearly depends on which order is "pulled off" to see which orders are outstanding and their average entry price.

                            I have my Options set for LIFO in the Cotrol Center options. Also, I am using named entries and exits to that in the example above I am selling 1 from the third order c (your chart shows the line drawn correctly).

                            I am urging you to believe me that this is a problem. As yet I have only identified real issues that you have corrected in subsequent releases.

                            Thanks....

                            Mark

                            Comment


                              #29
                              On #1: We would need a step by step scenario to reproduce.
                              On #2:
                              - You are talking about the open position of a strategy on the strategies tab no?
                              - If so, do you believe the position price is incorrect?
                              - If so, what are the execution prices which made up the position price?

                              Comment


                                #30
                                see below:

                                On #2:
                                - You are talking about the open position of a strategy on the strategies no?

                                Everywhere, yes in the Unrealized PnL on the stratigies tab and the Open PnL on the Dome and the value returned by this function:

                                Position.GetProfitLoss...... as I showed earlier in the thread

                                The are all incorrect based on LIFO and the named entry/exit orders as I have described

                                - If so, do you believe the position price is incorrect?

                                The Unrealized PnL is incorrect and because I see the brown "Average" price in the dome that is also incorrect for a LIFO senario where using named entry exit order and LIFO as I desacribed in my last post

                                - If so, what are the execution prices which made up the position price?

                                I am running the strategy every sigle day on a live account with real money so every day this happens at various prices, etc.


                                BTW I love this software, it is great. This is just an open problem for me....

                                Thanks....

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                637 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                366 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                107 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                569 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                571 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X