Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetProfitLoss with currencies

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

    GetProfitLoss with currencies

    NT Support,

    Could you please help me here?

    Does this look like the right output from the included code? Note the change in PnL based on the close price change. Is there an error in the GetProfitLoss method?


    Date / Time 10/09/2010 15:02:00
    Instrument $USDJPY
    Close 84.25
    Position = Long
    Quantity = 20000
    Avg Entry Price =84.23
    NT PnL 399.99999999992
    Date / Time 10/09/2010 15:03:00
    Instrument $USDJPY
    Close 84.25
    Position = Long
    Quantity = 20000
    Avg Entry Price =84.23
    NT PnL 399.99999999992
    Date / Time 10/09/2010 15:04:00
    Instrument $USDJPY
    Close 84.22
    Position = Long
    Quantity = 20000
    Avg Entry Price =84.23
    NT PnL -200.000000000102
    Date / Time 10/09/2010 15:05:00
    Instrument $USDJPY
    Close 84.22
    Position = Long
    Quantity = 20000
    Avg Entry Price =84.23
    NT PnL -200.000000000102

    Code:
                            int x = 0;
                            foreach (Position p in Positions) {
                            
                                if (p.MarketPosition != MarketPosition.Flat && BarsPeriods[x].Value == 1) {
                                    
                                
                                    day_pnl_open += p.GetProfitLoss(Closes[x][0], PerformanceUnit.Currency);
                                
    
                                    if (p.Instrument.FullName == "$USDJPY") {
                                        
                                        Print("Date / Time "+ Time[0].ToString());                                        
                                        Print("Instrument "+ BarsArray[x].Instrument.FullName);
                                        Print("Close " + Closes[x][0]);
                                        if (p.MarketPosition == MarketPosition.Short) {
                                        
                                            Print("Position = Short ");
                                            
                                        } else {
                                        
                                            Print("Position = Long ");
                                            
                                        }
                                        
                                        
                                        Print("Quantity = " + p.Quantity);
                                        Print("Avg Entry Price =" + p.AvgPrice);
                                        Print("NT PnL "+ p.GetProfitLoss(Closes[x][0], PerformanceUnit.Currency));
                                        
                                    
                                    }
                                    
                                }
                                
                                x++;
                                
                            }
    Thanks,

    drolles

    #2
    Hi drolles,

    Simulated PnL for FOREX is based on a standard unit size of 100,000. Please try with this quantity and let us know if the numbers are more like you're expecting. Additional information on running FX strategies is available here:

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for that.

      Firstly, Is there a dev request in to fix this?

      Secondly, can you please confirm that then using GetProfitLoss() with the percentage flag this problem is avoided?

      Thanks and regards,

      drolles

      Comment


        #4
        What do you feel is working incorrectly here? That PnL for FOREX is based on 100,000 unit size?
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,

          Thanks for the reply.

          What do you think is appropriate functionality here?

          Thanks and regards,

          drolles

          Comment


            #6
            Current functionality seems appropriate. There is not a centralized market to designate a standard pip value and quantity. If you sim trade FOREX in any of the order entry windows you'll see what NT uses for quantity and the resulting Pnl.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Ryan,

              Thanks for the reply.

              Do you have the influence in NT to change the functionally? Who is the product manager? And does he / she have authority to change the functionality?


              Thanks and regards,

              Dan

              Comment


                #8
                No, I work in support at NinjaTrader, but can communicate any ideas to our product manager. If there's some area you feel NinjaTrader can be improved, please post your suggestion here or to our feedback suggestion area and we'll make sure these are submitted to Josh our product manager.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Ryan,

                  Thanks timely reply as usual.

                  Can I suggest make the most effective use of everyone's time that you have Josh review the thread and we get his comments on if he feels that a set of functionality that ignores the position size being applied to a position, that is meant to be reporting a position PnL is right?

                  Thanks and regards,

                  drolles

                  Comment


                    #10
                    If you feel there is a bug in NinjaTrader, please post the following:
                    1) A simplified script using only supported techniques. If you are wondering what is supported or not, check for it in the NinjaScript documentation. Include the complete file so we can see, for example, the additional series you have added to your script.
                    2) Steps needed to reproduce. Include any specific setup required so that we can see exactly what you're seeing on our end.
                    3) An explanation of what you are expecting to see compared to what you are actually seeing.

                    Once we have that, I'm happy to confirm on our side here and advance any issue to development.
                    Last edited by NinjaTrader_RyanM1; 08-30-2011, 04:42 PM.
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Ryan,

                      Thanks for that. Please see my previous post for suggestion on how to preceed. I think the issue is clear and what you request is unnecessary. I would like to see Josh's reply please.

                      Thanks and regards,

                      drolles

                      Comment


                        #12
                        Hello,

                        Thanks for the forum post.

                        Wanted to let you know that I will have Josh review this thread here shortly.

                        Just want to clarify for when Josh reviews the thread end of the day today or tomorrow.

                        Main concern here.

                        Is that back testing is setup to return PnL values for standard lot size only correct? Or is this related to the ticket you have open with Bert for the PnL reporting in backtest on non-USD pairs?

                        As when I review the thread its not 100% clear what we want Josh to review.

                        Thanks.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by aa731, Today, 02:54 AM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by BarzTrading, Today, 07:25 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post BarzTrading  
                        Started by i019945nj, 12-14-2023, 06:41 AM
                        5 responses
                        65 views
                        0 likes
                        Last Post i019945nj  
                        Started by ruudawakening, Today, 12:58 AM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by thread, Yesterday, 11:58 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X