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

Strategies that use MAX() or MIN() take infinity to optimize

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

    Strategies that use MAX() or MIN() take infinity to optimize

    Today I once again noticed that strategy conditions, that include MAX() or MIN() functions take like forever to optimize.

    I ran an optimization test with 100 (!) iterations (values from 1 to 100) and it took 3,5 Hours!

    This is my personal record for the longest optimization.

    And formula was like this:

    Low[0] < (MAX (High, BarsSinceEntryExecution()+1)[0] - (TickSizeVariable * TickSize)) // Idea around it is to mimic End-of-trade drawdown real time: for long trade to take current low and see if it's lower than maximum high since execution minus X number of ticks.

    So nothing fancy, but it took soo long. Any way to improve it?

    I tried converting that MAX (High, BarsSinceEntryExecution()+1)[0] into variable and then calling it, but optimization didn't get faster.

    #2
    Hello UltraNIX, thanks for your post.

    If that is the amount of time it took for the code to run, then that's the amount of time it needs to complete. The only way to test alternatives would be to make your own Max and BarsSinceEntry methods to see if they are faster. Also, you could test a smaller number of iterations + a smaller time frame to see if there is some kind of exponential growth problem with the strategy.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I am considering upgrading to new pc that would run those calculations faster. Can you advice which part of it should I pay most attention? RAM? Processor? Other?

      Comment


        #4
        Hello UltraNIX, thanks for your reply.

        The best CPU you can get would be advisable. Also, a high amount of RAM would be best, over 16 GB should be enough for heavy backtesting.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by elirion, Today, 01:36 AM
        0 responses
        3 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        3 views
        0 likes
        Last Post gentlebenthebear  
        Started by samish18, Yesterday, 08:31 AM
        2 responses
        9 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by Mestor, 03-10-2023, 01:50 AM
        16 responses
        389 views
        0 likes
        Last Post z.franck  
        Started by rtwave, 04-12-2024, 09:30 AM
        4 responses
        34 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Working...
        X