• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 DariusDeck, Yesterday, 04:22 PM
            4 responses
            32 views
            0 likes
            Last Post DariusDeck  
            Started by StevenNelson, Today, 05:49 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by fx.practic, Today, 01:41 AM
            0 responses
            11 views
            0 likes
            Last Post fx.practic  
            Started by wolfcuring, Today, 01:29 AM
            0 responses
            4 views
            0 likes
            Last Post wolfcuring  
            Started by BrandonT1292, 06-17-2019, 03:03 PM
            2 responses
            31 views
            0 likes
            Last Post thinarthrill  
            Working...
            X