Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamic Parameter Initialization

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

    Dynamic Parameter Initialization

    I need to be able to compute the initial value of a Strategy parameter. But the Initialization() method in indicators and strategies is invoked for both parameter initialization and indicator/strategy launching.

    For example, the Initialization() method for a strategy is invoked 3 times: (1) when the STRATEGIES menu is opened; (2) when the Strategy is selected as NEW and (3) when the Strategy is launched (APPLY).

    It would be very useful if the Initialization method had an optional parameter which indicated whether the invocation was for parameter initialization, (1) and (2) above, or for launching, (3) above.

    My customers are in the USA. The starting time for our trading is 09:30 EST. I need to prompt my users with a starting time consistent with their local time zone, e.g., 06:30 in California.

    Thanks,

    RVR

    #2
    Thanks for the suggestion. For now, you can use the first call in OnBarUpdate(), when CurrentBar == 0.
    RayNinjaTrader Customer Service

    Comment


      #3
      Why Didn't I Think of That?

      Ray,

      Thanks for the quick response.

      That does make life much simpler!

      RVR

      Comment


        #4
        That Doesn't Do It

        Ray,

        I think you missed my point. If I set the initial parameter value in Initialization() that is the only value ever seen in Initialization() or in OnBarUpdate(), regardless of the value of the CurrentBar.

        A solution is to declare and initialize a PRIVATE boolean variable ParamsNotSet to TRUE. In one of the PARAMETER definitions in the SET method, set ParamsNotSet to FALSE. So in Initialize() you can test ParamsNotSet to determine whether you should set the parameter's initial value or process the final parameter value.

        This should really be an optional parameter of Initialize() but the above solution is working fine for me in the current release.

        Thanks,

        RVR

        Comment


          #5
          I understood, thanks for clarifying.
          RayNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          567 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          330 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          547 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          548 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X