Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Elegan indicators' grid parameters copy into a strategy

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

    Elegan indicators' grid parameters copy into a strategy

    I am looking for an elegant way to replicate and indicators' grid parameters into its calliing strategy.
    I do have an indicator with its own grid parameters. This indicator generates a signal. This indicator is also added to a strategy that 'executes' the signal. So I copy those same grid parameters in the strategy and I am assuring that the added indicator will update its parameter to reflect those of the strategy.
    In other words I replicate the grid parameters code on both the indicator and the strategy.
    I wander if there is a way to avoid this same duplication so I can add and indicator to a strategy and get the strategy to acquire those same indicator's parameter into its own grid. I think this would make the code more elegant and better structured.
    I hope my question is clear.
    Best
    G

    #2
    Originally posted by giogio1 View Post
    I am looking for an elegant way to replicate and indicators' grid parameters into its calling strategy.
    I do have an indicator with its own grid parameters. This indicator generates a signal. This indicator is also added to a strategy that 'executes' the signal. So I copy those same grid parameters in the strategy and I am assuring that the added indicator will update its parameter to reflect those of the strategy.
    In other words I replicate the grid parameters code on both the indicator and the strategy.
    I wander if there is a way to avoid this same duplication so I can add and indicator to a strategy and get the strategy to acquire those same indicator's parameter into its own grid. I think this would make the code more elegant and better structured.
    I hope my question is clear.
    Best
    G
    Ideally you don't have to copy any of the code, except the properties from your indicator to the strategy. What you can do is code the indicator to expose all the values that you need and then in the strategy declare a variable that "will be your custom indicator:"
    Code:
    private MyIndicatorName indEntry; // Change MyIndicatorName to the name of your indicator
    Then in DataLoaded:
    Code:
    indEntry = MyIndicatorName(Property01, Property02); // Update Property01, Property02, etc. with what your indicator calls for
    Then in OnBarUpdate, you can reference what is exposed in the indicator:
    Code:
    double plot0Value = indEntry.PlotName[0]; // Grab the information you need from your strategy
    All the above is very generic, but hopefully you get the idea. If it's not working for you, if you post the code, we can probably get it to work relatively quickly.

    Comment


      #3
      Yes. Thank you Jack. This is what I also do. I wanted a confirmation that I need to copy the properties. Best. G

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      53 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X