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

ProfitCurrency

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

    ProfitCurrency

    I am confused about the value returned with the following code:

    Trade lastTrade = Performance.RealtimeTrades[Performance.RealtimeTrades.Count - 1];
    lastProfit = lastTrade.ProfitCurrency;

    What is the value returned by ProfitCurrency?

    I am trading a single ES contract.

    Is it PnL of the last trade in dollars? Or?

    And I assume the value is positive for a PnL gain and negative for a PnL loss?

    Finally, does the value include commission, or do I need to account for commission myself?

    Thanks for reading.


    #2
    Hello,


    "What is the value returned by ProfitCurrency?"


    ProfitCurrency will return you PnL in currency.


    "Is it PnL of the last trade in dollars? Or?"
    You specified Currency by using ProfitCurrency. So the PnL will display in the currency of the region you have chosen on your PC.


    "And I assume the value is positive for a PnL gain and negative for a PnL loss?"
    Yes.


    "Finally, does the value include commission, or do I need to account for commission myself?"


    Commission can be included in your PnL calculations provided you have correctly configured NinjaTrader. Commission values can be defined for each connectivity provider per instrument and per instrument type.
    I have provided a link below to our YouTube that goes over setting up commissions values.

    Commission values are used in the following order:
    • From the instrument if a commission value has been defined else
    • From the instrument type if a commission value has been defined else
    • No value is used since none have been defined

    Please follow the instructions below to define commission values per instrument type:

    Please follow the instructions below to define commission values per instrument:



    Critical: Ensure that 'Apply commission to PnL calculations' is enabled under Tools > Options > General tab.

    Shawn B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ShawnB View Post
      Hello,


      "What is the value returned by ProfitCurrency?"


      ProfitCurrency will return you PnL in currency.


      "Is it PnL of the last trade in dollars? Or?"
      You specified Currency by using ProfitCurrency. So the PnL will display in the currency of the region you have chosen on your PC.


      "And I assume the value is positive for a PnL gain and negative for a PnL loss?"
      Yes.


      "Finally, does the value include commission, or do I need to account for commission myself?"


      Commission can be included in your PnL calculations provided you have correctly configured NinjaTrader. Commission values can be defined for each connectivity provider per instrument and per instrument type.
      I have provided a link below to our YouTube that goes over setting up commissions values.

      Commission values are used in the following order:
      • From the instrument if a commission value has been defined else
      • From the instrument type if a commission value has been defined else
      • No value is used since none have been defined

      Please follow the instructions below to define commission values per instrument type:

      Please follow the instructions below to define commission values per instrument:



      Critical: Ensure that 'Apply commission to PnL calculations' is enabled under Tools > Options > General tab.

      Shawn. Still confused...

      What do you mean by "...So the PnL will display in the currency of the region you have chosen on your PC.""" ??

      Comment


        #4
        Hello,

        For example, if your PC is set to the US, currency will display in dollars.
        Shawn B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ShawnB View Post
          Hello,

          For example, if your PC is set to the US, currency will display in dollars.
          To recap. .ProfitCurrency will give the net PnL for the specified trade (including commission if properly configured)?

          Comment


            #6
            Hello,

            That is correct
            Shawn B.NinjaTrader Customer Service

            Comment


              #7
              Sorry to be a pest, but I am finding that this is not what ProfitCurrency is returning. No matter how many ticks in the trade, it's returning either 50 or -50 depending on whether the trade won or lost.

              So, it appears to be returning the dollar value of one tick for an ES contract and not the net profit of the trade

              Comment


                #8
                Hello,


                Using .ProfitCurrency will return the net PnL for the specified trade. To return the PnL of your account, you can use GetAccountValue():
                Code:
                [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]GetAccountValue(AccountItem.RealizedProfitLoss);[/SIZE][/SIZE][/FONT]
                [/FONT]

                I have included the GetAccountValue() Help Guide to assist you further.
                Shawn B.NinjaTrader Customer Service

                Comment


                  #9
                  If that is the case, why does the documentation say that you must multiply ProfitCurrency by the trade Quantity to get the profit?

                  Comment


                    #10
                    Hello,

                    This is because .ProfitCurrency is a double value representing profit in currency for one traded unit. This is why you must multiply this value by the trade Quantity to get the total profit in currency for the trade.
                    Shawn B.NinjaTrader Customer Service

                    Comment


                      #11
                      Ok. Other questions.

                      why is the last trade .Count - 1?

                      do RealtimeTrades work for Sim accounts?

                      Comment


                        #12
                        Hello,

                        Performance.AllTrades.Count is an int value representing the number of trades in the collection. The most recent trade taken will be at an index value of the total trades in the collection minus 1.
                        Shawn B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by GussJ, 03-04-2020, 03:11 PM
                        11 responses
                        3,229 views
                        0 likes
                        Last Post xiinteractive  
                        Started by andrewtrades, Today, 04:57 PM
                        1 response
                        14 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by chbruno, Today, 04:10 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post chbruno
                        by chbruno
                         
                        Started by josh18955, 03-25-2023, 11:16 AM
                        6 responses
                        441 views
                        0 likes
                        Last Post Delerium  
                        Started by FAQtrader, Today, 03:35 PM
                        0 responses
                        12 views
                        0 likes
                        Last Post FAQtrader  
                        Working...
                        X