Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Template for Formula Based Indicator with Average

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

    Template for Formula Based Indicator with Average

    Hi,


    I am having a issue building a formula based indicator. Since this is a issue I am sure many people have and will keep having I will make it very generic so everyone can use it.


    The question is: Can someone build a WORKING formula of the following math with a length attached to it that can be changed.


    The Average True Range Indicator is a good example. High – Low formula with a average and the example of how the math is written so anyone can copy and paste it to change whatever is needed.

    The formula: ((H-L) + (H[1]-L[1])) /2

    This formula (or any other formula that would make a good example) with a changeable moving average so that it can be made longer or shorter.


    Thanks,

    #2
    Hello DZ954,

    Thank you for your post.

    I do not understand the concept of adding a Length to the formula, can you expand on this idea?

    Comment


      #3
      Let’s say I wanted to plot the average price with an input for the formula below (or any formula that includes math and bar references). How would this be done?


      (High[0] + High[1] /2) +Open[0];


      The other question/issue is I did get a formula like this to work on the current bar but after I loaded the chart once it won’t show after that. What can that be?



      The end result needed is to have a template that anyone can just put in the math formula and then test lengths of that formula.

      Comment


        #4
        Originally posted by DZ954 View Post
        Hi,


        I am having a issue building a formula based indicator. Since this is a issue I am sure many people have and will keep having I will make it very generic so everyone can use it.


        The question is: Can someone build a WORKING formula of the following math with a length attached to it that can be changed.


        The Average True Range Indicator is a good example. High – Low formula with a average and the example of how the math is written so anyone can copy and paste it to change whatever is needed.

        The formula: ((H-L) + (H[1]-L[1])) /2

        This formula (or any other formula that would make a good example) with a changeable moving average so that it can be made longer or shorter.


        Thanks,

        There is nothing to code. What you look for is a simple moving average of the range. Just open a chart, add a SMA with a period of 2 and then select the range indicator as input series.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        134 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        75 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        119 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        114 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        90 views
        0 likes
        Last Post CarlTrading  
        Working...
        X