Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 inanazsocial, Today, 01:15 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        6 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        1 view
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Started by Davidtowleii, Today, 12:15 AM
        0 responses
        3 views
        0 likes
        Last Post Davidtowleii  
        Working...
        X