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 sjsj2732, Yesterday, 04:31 AM
          0 responses
          35 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          287 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          286 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          133 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          92 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X