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 ZeroKuhl, Today, 04:31 PM
              0 responses
              7 views
              0 likes
              Last Post ZeroKuhl  
              Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
              54 responses
              5,336 views
              0 likes
              Last Post Gaterz
              by Gaterz
               
              Started by ETFVoyageur, 05-07-2024, 07:05 PM
              11 responses
              74 views
              0 likes
              Last Post -=Edge=-  
              Started by _Zero_, 04-10-2020, 03:21 PM
              145 responses
              7,900 views
              6 likes
              Last Post johng2
              by johng2
               
              Started by TheTradingMantis, 01-19-2023, 02:05 AM
              43 responses
              921 views
              0 likes
              Last Post jmagaia
              by jmagaia
               
              Working...
              X