Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Good coding technique

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

    Good coding technique

    Understanding the limitations of answering such "general questions" as the one I am about to ask....with specific "yes/no" answers.....I'd appreciate any guidance you have to offer :

    1. Is it generally considered to be a better coding policy to split individual pieces of indicator based coding into separate indicators....or combine them into one?
    Example: (two indicators running on a chart)
    - Indicator1 plots a 5min moving average on a tick chart
    - Indicator2 performs calculations on previous 5min candles (MAX High/Low and
    maximum bar size...and also plots this information on a tick chart.

    Would it generally be considered better coding form to merge the two 5min based indicators into one indicator...making all 5min calculations in one piece of code....or leaving them separated into two individual indicators?

    -------------------------------------------------------------------------------------
    2. Is this answer above the same for indicator code that plots on the same time frame as the chart....Ex: Tick chart moving average and a tick chart calculation of previous bar sizes /High/Low.

    ----------------------------------------------------------------------------------------
    3. Does the combination of chart time frame and indicator time frame (assuming they are different) have any impact on the answers to #1 and #2 ?
    Ex: Tick charts with minute based indicators.....versus minute charts with tick based indicators....


    Thanks......

    #2

    Comment


      #3
      Photog, as bukkan has observed, it is best to combine as much as possible while retaining re-usability for future projects.
      AustinNinjaTrader Customer Service

      Comment


        #4
        Thanks for the advice...and the help!

        Comment


          #5
          Originally posted by photog53 View Post
          Understanding the limitations of answering such "general questions" as the one I am about to ask....with specific "yes/no" answers.....I'd appreciate any guidance you have to offer :

          1. Is it generally considered to be a better coding policy to split individual pieces of indicator based coding into separate indicators....or combine them into one?
          Example: (two indicators running on a chart)
          - Indicator1 plots a 5min moving average on a tick chart
          - Indicator2 performs calculations on previous 5min candles (MAX High/Low and
          maximum bar size...and also plots this information on a tick chart.

          Would it generally be considered better coding form to merge the two 5min based indicators into one indicator...making all 5min calculations in one piece of code....or leaving them separated into two individual indicators?

          -------------------------------------------------------------------------------------
          2. Is this answer above the same for indicator code that plots on the same time frame as the chart....Ex: Tick chart moving average and a tick chart calculation of previous bar sizes /High/Low.

          ----------------------------------------------------------------------------------------
          3. Does the combination of chart time frame and indicator time frame (assuming they are different) have any impact on the answers to #1 and #2 ?
          Ex: Tick charts with minute based indicators.....versus minute charts with tick based indicators....


          Thanks......
          Unfortunately, the answer to all your questions is: "it depends ..."

          If the plots you are designing will (?almost) always be used together, then it makes sense to not incur the overhead of calling separate indicators, and making essentially the same calculations twice in different indicators, so you would put all the code in one indicator.

          OTOH, if these are plots are kind of like utility indicators which you will combine with others in various ways, then it makes sense to retain the flexibility of calling compact code from other places, so you may want to code them as separate indicators.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          585 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          340 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X