Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MR realized bug

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

    MR realized bug

    see pic....

    I am printing out
    unreal real total ....at start of each line

    you can see that MR treats these differently

    it is realizing loss (-5) while trade is still active....

    no commissions are in the calcs at all

    at the very least, code picks up a different number than MR plots in the dialog
    Attached Files
    Last edited by ATI user; 02-02-2010, 03:17 PM.

    #2
    ATI user,

    Please provide the code snippet as I do not know what those numbers represent at this point in time.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      the column on the left is:
      GetAtmStrategyUnrealizedProfitLoss(atmStrategyId

      second column from left is :
      GetAtmStrategyRealizedProfitLoss(atmStrategyId

      third from left is total of left two columns.

      in other words it should match what is shown in MR dialog...

      and it does with only one position on ..see pic 1

      .......


      here is the problem;

      when using `KeepStrategy....` setting you can hedge...i.e. be long and short at same time in same account...this is an excellent feature

      however, while DOM and Charttrader handle this condition fine, MR does not. When the hedge goes on, MR thinks it is flat and therefore realizes pnl...see pic 2

      when hedge comes off, MR uses last trade to set new net long or short position entry (which in my opinion has never been accurate when hedging) and gives incorrect numbers...see pic 3....which the correct numbers from code will never match...(code is correct because is keeps track of each individual strat id and therefore has no problem with hedging).

      in live trading in cash account I suspect that hedging calculations may not be a problem because Market Analyzer uses numbers from broker

      however in MR, MA does not match the accuracy being shown by hedge in DOM and Charttrader ...even when all trades are closed....because of the way it resets the entry price when coming out of the hedge...

      this issue, at least the totalPnl, is reduced by setting ``Use last trade for PnL`` to unchecked....then when hedge is on totalpnl is correct although uneralized and realized are not....see pic 4....and when hedge comes off, same errors only with correct total...see pic 5

      is this a bug with respect to unreal and real in the MR when hedging
      Attached Files
      Last edited by ATI user; 02-02-2010, 04:21 PM.

      Comment


        #4
        ATI_user, I read and re-read your post and there are a few things we'll need clarified before we can continue. What do you mean by a hedge? I'm familiar with the term, I just need to know exactly how you are applying it in this situation. How does your hedge "go on" and "come off"? What "Keep Strategy..." setting are you talking about? Lastly, would it be too much trouble for you to share with us the code you're using to prove that this is in fact a bug?
        AustinNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Austin View Post
          What do you mean by a hedge?
          hedge...i.e. be long and short at same time in same account.

          Originally posted by NinjaTrader_Austin View Post
          How does your hedge "go on" and "come off"?
          when you are long and put on an opposing short in the same acct, you are net flat or 'hedged'...i.e. hedge is 'put on'
          when one of the positions comes off, you are net long or short (not flat)...i.e. hedge has 'come off'

          Originally posted by NinjaTrader_Austin View Post
          What "Keep Strategy..." setting are you talking about?
          it is a Charttrader Properties setting ...i.e. " KeepSelectedAtmStrategyTemplateOnOrderSubmission "...sorry...too lazy to copy/paste or type in full last post

          Originally posted by NinjaTrader_Austin View Post
          Lastly, would it be too much trouble for you to share with us the code you're using to prove that this is in fact a bug?
          yes...all you need is to have sampleatmstrat go long...then 3 bars later go short in same acct....in MR....check MA and you will see when only long, numbers are accurate....when hedged, they are not accurate (per my explanation above)...and when hedge comes off, only total is correct...
          Last edited by ATI user; 02-02-2010, 05:06 PM.

          Comment


            #6
            ATI_user, thank you for the clarification. We will look into the issue and get back to you.
            AustinNinjaTrader Customer Service

            Comment


              #7
              ATI_User, I tested this with our 'SampleAtmStrategy' - here's what I see

              - PnL is reported correctly when we trigger a long from the strategy

              - now with 'Keep Mode...' on I go short in the same Replay account to hedge myself, essentially net flat, no having a position.

              - Position tab reflect that properly, so does the MA for me, showing Static Pnl combining trades done so far.

              - Once I drag the second's trade's stop into price to take the hedge of

              > PnL starts updating as expected for me according to my last entry that exited the hedging scenario.

              Could you please clarify what you think is off here?

              Thanks

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                Could you please clarify what you think is off here?
                'think is off' ?

                compare the MA unrealized and realized and totalpnl in the MA and with the same in the output window in pics 4 and 5 in my post 3 above...

                they are not even close....which is why I did not want to rely on the them, for hedges, to come up with a reliable totalpnl....impossible...especially if 'use last trade for pnl' is checked...out by $100s in MR

                Comment


                  #9
                  ATI user, is any way you could provide your snippet so I can run exactly the same scenario here to compare and see what you prints access?

                  You'll need to consider here, one ATM is initiated by the NinjaScript strategy and one manually from the DOM (at least in my test case).

                  If it's possible to test with your scenario, please contact me directly at support at ninjatrader dot com Attn Bertrand - thanks.

                  Comment


                    #10
                    Originally posted by NinjaTrader_Bertrand View Post
                    ATI user, is any way you could provide your snippet so I can run exactly the same scenario here to compare and see what you prints access?

                    You'll need to consider here, one ATM is initiated by the NinjaScript strategy and one manually from the DOM (at least in my test case).

                    If it's possible to test with your scenario, please contact me directly at support at ninjatrader dot com Attn Bertrand - thanks.
                    in my example, the strat places the hedge, not the DOM

                    Comment


                      #11
                      ATI_user I see thanks for clarifying - any sample snippet you could provide that I could use for reproducing on my end then?

                      Thanks

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      597 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      343 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      556 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      555 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X