Announcement

Collapse
No announcement yet.

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

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X