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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        173 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        328 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        252 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        354 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        181 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X