Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using same indicator instance during optimization

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

    Using same indicator instance during optimization

    Hi,

    I have an indicator that reads from several external files on initialization.

    I have a strategy that does not contain much logic, it basically just calls the indicator.

    When running optimizations in Strategy Analyzer, there is no need that the indicator would re-read those external files on every optimization iteration.

    Problem is the indicator is instantiated in the strategy's DataLoaded state. So if I set IsInstantiatedOnEachOptimizationIteration to false, how can it help to use the same indicator instance?

    Thank you.

    #2
    Hello digibob,

    Thank you for your post.

    IsInstantiated... reuses the strategy instance, not the indicators within. The indicator would still be re-instantiated with each optimization iteration. You could try moving the indicator logic into the strategy and specifically resetting any variables/series/etc that may need to be reset.

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hi Kate. Thank you for your reply.

      I was afraid of that.

      The indicator exists on its own unrelated to any strategy, currently some tens of thousands of code lines and is a continuous work in progress. If I make a strategy with the same code I would then have duplicate everything and always have to update two files. I'd like to keep things in one place. I was thinking of using an AddOn, but it wouldn't help for this case without knowing when an optimization starts and ends (first and last iterations). To my knowledge this information is not available. So I'm out of luck here.

      Kind regards.

      Comment


        #4
        Kate, I moved all the objects to the strategy, with IsInstantiatedOnEachOptimizationIteration set to false, but the objects are null on every optimization iteration.

        I also copied the example from the doc page as is, to make a test strategy, and this too shows that the myTrades dictionary is null on every optimization iteration.

        What is missing?

        Comment


          #5
          Ok I see the reason in Chelsea's post here. More than one strategy instance is used. I didn't try the optimization with enough iterations to see the difference. All is good now.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          71 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          143 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          76 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          47 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          51 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X