Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ROC indicator as the sum of two different time periods

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

    ROC indicator as the sum of two different time periods

    Hello

    I have no coding knowledge but would like to build a simple indicator for Ninja Trader 8. My indicator should be the sum of two ROC indicators with different time periods (e.g the sum of ROC(15) and ROC(50)). I tried to do this with the NT-wizard, and for many people this must be easy and done in 5 minutes, but I'm trying since days and just can't figure out how to create such an indicator. I would be very happy if someone could help me with this.
    Best regards,
    Michael

    #2
    Hello value57,

    Thanks for your post and welcome to the NinjaTrader forums!

    Starting with the Ninjatrader indicator wizard would be the best way to create the overall structure of the indicator. When using the wizard you would want to have a good feel for what inputs you would want. Inputs would be whatever you would want exposed in the User interface to be able to change without having to recode your strategy. Example would be if you wanted to change the period of either or both ROCs.

    On the output side you would need to create a plot and the wizard will ask if you want to do that and you can select the color of the plot.

    Once you have completed the wizard then you would want to work within the OnBarUpdate() section. OnBarUpdate() is called based on the "Calculate" property of the indictor. Calculate.OnBarClose is the default and it means that when the chart bar closes, the OnBarUpdate() is called once per bar. Other choices are Calculate.OnEachTick oe Calculate.OnPriceChange, these are relevant only for live data and they increase the frequency of calling OnBarUpdate() and any calculations your indicator would perform.

    In the onBarUpdate() what you would need would be to take the name of the plot and do something like this:

    NameOfPlot[0] = ROC(15)[0]+ROC(50)[0];

    Alternately, you can do this:

    Value[0] = = ROC(15)[0]+ROC(50)[0];

    Value is associated with the one and only plot of the indicator.


    Below I will provide some information that may help you get further along in your understanding of Ninjascript.

    Ninjscript is the programming language of NinjaTrader. Ninjascript is based on C# Programming language and we recommend a good working knowledge of C#. We do not provide C# education/tutorials as these can be found on the internet in many places.

    If you are not familiar with C# and do not wish to learn to program, you can still create strategies (automated trading) without programming knowledge by using the Strategy Builder. The strategy Builder allows you to create basic to medium complexity strategies. The Strategy Builder will also convert your conditions and actions into viable C# code so that you get the same speed and performance as a Ninjascript created strategy. You can also view this code that is created and that can be very useful in learning Ninjascript as well. You can copy and paste code from the builder into another script.

    Here are the educational resource available on the strategy builder:
    Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
    Previous recording of the Strategy Builder 301 webinar:
    https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
    Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htm

    To create an indicator or a non strategy builder strategy, you would need to use the indicator or strategy wizard. These will create the basic structures including the inputs and outputs. Here are is where you can find out further about the wizards: https://ninjatrader.com/support/help...?ns_wizard.htm

    Once you have created a Ninjascript strategy or indicator you would need to use the Ninjascript editor for further coding and debugging, here is a link to the overall Ninjascript editor: https://ninjatrader.com/support/help...t8/?editor.htm

    Here is a link to live webinars where you can find the Ninjascript editor and strategy builder, alternating on Thursdays: https://ninjatrader.com/PlatformTraining

    Here is a link to a recording of the Ninjascript editor webinar:
    https://www.youtube.com/watch?v=H7aD...We0Nf&index=14

    Here are various links to key help guide sections, each link will have further cascading links:

    https://ninjatrader.com/support/help...erence_wip.htm

    https://ninjatrader.com/support/help..._reference.htm

    https://ninjatrader.com/support/help..._resources.htm

    https://ninjatrader.com/support/help...ce_samples.htm

    https://ninjatrader.com/support/help.../nt8/?tips.htm


    In addition, you may want to review, use, or modify the freely available scripts from the NT user apps in the Ninjatrader Ecosystem. (Note this includes both NinjaTrader7 and Ninjatrader8 scripts that are not compatible with the other version, you can click the "show all" button for segregation)



    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    Please let us know if we can be of further assistance.

    Comment


      #3
      It works, I'm a NT-genius... Ok, actually you are the NT-genius, Paul. Thank you very much for your help.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X