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

Each order shows as a trade in Trade Performance

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

    Each order shows as a trade in Trade Performance

    Click image for larger version

Name:	image.png
Views:	99
Size:	73.6 KB
ID:	1272677
    How do I get Trade Performance to count these as one trade? It shows hundreds of trades but in the chart example it's just one trade with 22 micros being used.

    Click image for larger version

Name:	image.png
Views:	93
Size:	59.6 KB
ID:	1272678

    #2
    Hello Lance El Camino,

    Thank you for your post.

    I suspect that the order had many partial fills, which means there could be separate entry prices/times and exit prices/times to be tracked in reporting. The Trade Performance report should be considered secondary to your actual brokerage statement; NinjaTrader does not have a concept of 'trades' in its reporting and simply pairs together executions. Each partial fill is a separate execution, and that is why they are counted as separate 'trades' in the reporting. This is a limitation of the Trade Performance reporting and how it is designed to work by pairing executions, so there is no way to get the report to show them all as one trade. The same would show up in strategy performance reporting from a chart or the Strategies tab of the Control Center.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      So I'm trying to limit the number of trades I take per session so does this also apply to SystemPerformance.AllTrades.count meaning the TradeCollection object adds one for each order rather than a trade?

      Comment


        #4
        You should rephrase and say "limit number of positions".

        The aggregate of all those 'trades' you see is the 'position'.

        Just my 2˘.

        Comment


          #5
          Thanks. Unless I'm wrong, there's no Position object or array that stores the past position performance. I'm needing to limit to a maximum of 2 positions per session, 1 per session if it's a win, and up to 2 if the first is a loss. I'm going to try using a variable to track the number of trades taken per session (int TradeTaken) and just reset it to zero at the beginning of each new session as well as another variable to get the account balance at the beginning of the session (double BeginningBalance):

          Declare variables:
          Code:
          private int TradeTaken;
                      private double Beginning Balance;
                      private double CurrentBalance;
                      private double SessionPnL;
          Count number of positions (trades) taken when execution occurs:
          Code:
          if (BarsSinceEntryExecution(0, "LongShort", 0) == 0)
                          TradeTaken++;​
          Reset at the beginning of next session and get the current account balance:
          Code:
          if (Bars.IsFirstBarOfSession)
                           TradeTaken = 0;
                           BeginningBalance = a.Get(AccountItem.CashValue, Currency.UsDollar);
          Then to see winners versus losers I can use a variable CurrentBalance to track the account balance:
          Code:
          CurrentBalance = a.Get(AccountItem.CashValue, Currency.UsDollar);
                       SessionPnL = CurrentBalance - BeginningBalance;
          Now add to entrance conditions. If the first trade is a winner, we are done. If the first trade loses, we get one more try:
          Code:
          if (TradeTaken == 0 || TradeTaken == 1 && SessionPnL < 0)
          Anything I might be missing here?

          Comment


            #6
            I forgot to add the account object:

            Code:
            Account a = Account.All.First(t => t.Name == "SimorLiveorPlayback");

            Comment


              #7
              Hello Lance El Camino,

              Thank you for your reply.

              Keeping track of the number of trades and the beginning balance via variables (as well as resetting the values at the beginning of a session) should work to suit your needs of setting conditions that limit to 2 entry submissions max. I suggest testing this on the Playback connection to ensure it is working as expected.

              Please let us know if we may be of further assistance.
              Emily C.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              1 view
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              8 responses
              61 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              4 responses
              3,289 views
              1 like
              Last Post jgualdronc  
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              5 views
              0 likes
              Last Post Option Whisperer  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              22 views
              0 likes
              Last Post halgo_boulder  
              Working...
              X