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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        26 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        15 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        9 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        10 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        17 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X