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

Custom TradeCollection WinningTrades Property is Null

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

    Custom TradeCollection WinningTrades Property is Null

    When I create a custom TradeCollection as referenced in this thread (https://ninjatrader.com/support/foru...radecollection) some properties are null:

    Code:
    TradeCollection trades = new TradeCollection(true, true);
    SystemPerformance.AllTrades.Where(t => t.Entry.Name == "Entry01").ToList().ForEach(t => trades.Add(t));
    var winningTrades = trades.WinningTrades; // null
    var losingTrades = trades.LosingTrades; // null
    Is there something else one needs to do for those properties to be populated?

    #2
    OK. I changed

    Code:
    TradeCollection trades = new TradeCollection(true, true);
    to
    Code:
    TradeCollection trades = new TradeCollection(false, true);
    and the properties are now populated.

    Can you tell me what I changed by doing this? The parameter name is only "sub".

    Thanks,

    Comment


      #3
      Hello BarzTrading,

      Using a custom trade collection would be general C# and is not documented as an intended use in the NinjaTrader help guide.

      However, that said, I am test adding to a custom trade collection using a secondary MSFT series with the sub parameter as false with new TradeCollection() and I am able to get performance and I am not able to reproduce this behavior.

      If you test this strategy on a 1 Day AAPL chart while connected to Kinetick End of Day (Free) (so that we can ensure you get daily data for equities) is the print showing the performance as 0?
      Attached Files
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thanks, Chelsea. Your example is not testing the issue I described. Most of the performance values are available. It is specifically the WinningTrades and LosingTrades properties of the TradeCollection that are not populated when sub=true.

        They are populated when sub=false.

        When I add the following to your example the results are consistent with mine:

        Code:
         if (trades.WinningTrades == null)
        {
             Print("WinningTrades is null");
        }
        else
        {
           Print("WinningTrades is NOT null");
        }

        Comment


          #5
          Hello BarzTrading,

          Thank you for catching that I was not looking at the Winning and Losing collections specifically.

          I was able to reproduce.

          I'm inquiring further with our development, however, this would be undocumented and I cannot guarantee I will get a reply.
          However, I will let you know anything I find out.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hello BarzTrading,

            Our development has confirmed that the sub parameter enables separating out the trade collections into winning/losing.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Christopher_R, Today, 12:29 AM
            0 responses
            7 views
            0 likes
            Last Post Christopher_R  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            166 responses
            2,235 views
            0 likes
            Last Post sidlercom80  
            Started by thread, Yesterday, 11:58 PM
            0 responses
            3 views
            0 likes
            Last Post thread
            by thread
             
            Started by jclose, Yesterday, 09:37 PM
            0 responses
            7 views
            0 likes
            Last Post jclose
            by jclose
             
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            10 responses
            1,415 views
            0 likes
            Last Post Traderontheroad  
            Working...
            X