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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            80 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            41 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            64 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            66 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X