Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization Fitnesses: Trading Days

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

    Optimization Fitnesses: Trading Days

    I'm working on a custom optimization fitness script and need the number of trading days that the "Time frame" spans. So, how is the number of trading days best obtained (that I can use in this script) ?

    #2
    Hello spottysallrite,

    The strategy.SystemPerformance would have the trades. You could look at the first index entry datetime and compare this with the last index exit datetime.

    Code:
    Print((strategy.SystemPerformance.AllTrades[0].Entry.Time - strategy.SystemPerformance.AllTrades[strategy.SystemPerformance.AllTrades.Count - 1].Exit.Time).Days);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      mmm. Doesn't that formula assume that there are trades on the first day as well as the last day?

      I tried dividing TradesCount by TradesPerDay, but it looks like the calc for TradesPerDay is off. Could you look into that as well?

      Seems like that since the "Summary" in the Strategy Analyzer has the Start date and the End date that this would be easily obtained. No ?

      Comment


        #4
        Is there no answer to this?

        Comment


          #5
          Hello spottysallrite,

          This would be undocumented, but try using the strategy.Bars.FromDate, strategy.Bars.ToDate.

          Hello, I want to build an optimization fitness that uses Start Date and End Date that is set manually in Strategy Analyzer's settings. I want to use that and not Minimum Trade Date and Maximum Trade Date, because for strategies with low trade numbers, there may not be enough data to get correct Start and End date. So how
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Works ! Thanks !!!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            54 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            72 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X