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

Commisions in backtesting

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

    Commisions in backtesting

    Hello,
    I have the following question: When running a backtest, at what point does NinjaTrader deduce commissions from the account being tested on? Are commissions taken as soon as an order is executed or when a round trip has been completed?
    Thanks
    Tal

    #2
    Hello Tal,
    Welcome to the forum and I am happy to assist you.

    The commission is added to the execution as soon as it gets filled. So if your first trade is a long then the commission is added when the long trade took place.
    Code:
    protected override void OnExecution(IExecution execution)
    {
       Print(execution.Commission);
    }
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Follow up

      Hi,
      So one more question
      When i query Position.GetProfitLoss(Close[0],Performance.Currency does that include the commission?
      Thanks

      Comment


        #4
        Hello talolard,
        Yes, commission is included in the calculation.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Thanks

          I wish I had asked that earlier!

          Comment


            #6
            I tested this and Position.GetProfitLoss(Close[0],PerformanceUnit.Currency) does NOT include commission (this is basically unrealized PNL) and updates on each bar.

            Performance.AllTrades.TradesPerformance.Currency.C umProfit DOES include commission but only updates after a trade is completed.

            Comment


              #7
              Hello tbwerz,

              Thank you for your post.

              This does in fact include the comission, but only one side of the commission.

              I have my Simulator set to a Minimum Commision of $2, that is $2 each side. So in Backtesting until the position closes this only shows as $2 on the "Position.GetProfitLoss(Close[0],PerformanceUnit.Currency)", so if I am up $700 it is reflected as $698.
              When the position closes it will show as $696 PnL.

              Please let me know if I may be of further assistance.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Segwin, 05-07-2018, 02:15 PM
              14 responses
              1,789 views
              0 likes
              Last Post aligator  
              Started by Jimmyk, 01-26-2018, 05:19 AM
              6 responses
              837 views
              0 likes
              Last Post emuns
              by emuns
               
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              6 responses
              3,293 views
              1 like
              Last Post jgualdronc  
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              13 views
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              11 responses
              63 views
              0 likes
              Last Post halgo_boulder  
              Working...
              X