Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get commissions in script?

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

    How to get commissions in script?

    How do I get the commissions and (un)realized profit/loss in a script?

    Also, the Strategy Performance window, the Strategies tab and the Accounts tab of the main window have a couple of issues relating to commissions.

    • The tabs do not have a column for commissions
    • The Strategy Performance window does not include commissions in the "Total net profit"


    I think Realized Profit should include commissions - that is the actual profit. If not, both the tabs and window should have additional columns to show what the actual profit is (profit + loss - commissions). I did an add of "loss" since it shows as negative in the Strategy Performance window.

    #2
    Hello wbennettjr,

    The commission is not applied to the trade until the trade is closed. Using Position.GetProfitLoss() would return the current unrealized PnL without the commissions.
    http://ninjatrader.com/support/helpG...profitloss.htm

    You could choose to add this your self with a calculation as the commission for the order can be captured in OnExecution with the execution.Commission.

    Below is a link to a video that shows where you can find commissions in the Strategy Performance report.
    http://screencast.com/t/grIlVuPj
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the help Chelsea,

      It seems I was mistaken. After digging into it a bit more, I found that the realized PnL does include commissions. The Accounts tab has a "Total commissions" column as well.

      Position.GetProfitLoss is for NT7 - in NT8 it is Position.GetUnrealizedProfitLoss.

      How do I get the Realized PnL? I'm looking at doing what the Market Analyzer column does. Is there an easier way?

      How do I add new columns to the Strategies tab?

      Wil

      Comment


        #4
        Hello wbennettjr,

        To find the realized PnL of the last trade.
        Code:
         Performance.AllTrades[Performance.AllTrades.Count - 1].ProfitCurrency
        Below is a link to the help guide where you can find information about trade performance.
        http://ninjatrader.com/support/helpGuides/nt7/trade.htm

        With the columns, you can enable and disable columns. You will not be able to add custom columns.
        To enable / disable columns:
        • Right-click the grid -> select Grid -> select Properties
        • Check or uncheck columns you want to see or not see -> click OK
        Chelsea B.NinjaTrader Customer Service

        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