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


Moving Average Differential indicator?

  • Filter
  • Time
  • Show
Clear All
new posts

    Moving Average Differential indicator?

    Does anyone know if an easy way to show the difference between 2 moving averages. Would prefer a simple text box, but an indicator would work too.

    Thanks for any help.

    Hello cmv727,

    Thanks for your post.

    Other than the MACD I'm not aware of an indicator that would show the differences between two moving averages.

    Perhaps others in the community will offer suggestions.

    If you wanted to create this yourself, we can assist you with links to learning Ninjascript to get you started.

    Alternatively, we can also refer you to 3rd party programmers who could provide that service
    Paul H.NinjaTrader Customer Service


      Sure, I'll take a crack at doing it myself. Haven't done that before, but if please send links.



        Hello cmv727,

        Thanks for your reply.

        I'll add the links below.

        Also, I created a starting point for you that you can copy and modify as you wish. As is it just determines the number of ticks difference between and SMA(10) and an SMA(20) and then prints that on the chart in the upper right corner. You can download and install the zipped file.

        NinjaTrader's Ninjascript is written in C# so you may wish to search for on-line references for learning C# as this controls the syntax rules for Ninjascript.

        If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started.

        All links below are publicly available.

        The entire Alphabetical Reference can be found with the following link:

        Below are links to Reference Samples online as well as some Tips and Tricks for both indicators and strategies. These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

        Click here to see our NinjaScript Reference Samples:

        Click here to see our NinjaScript Tips:

        The best way to begin learning NinjaScript is to use the Strategy Builder. With the Strategy Builder you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button. Please see the helpguide here:

        I'm also proving a link to a pre-recorded set of videos 'Strategy Builder 301' and 'NinjaScript Editor 401' for you to view at your own convenience.
        Strategy Builder 301 -
        NinjaScript Editor 401 -

        If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our NT7 help guide first:

        Here is a link to the Educational Resources section of the Help Guide to help you get started with NinjaScript:

        There is also a growing library of user-submitted custom indicators (100+) that can be downloaded from our support forum. Please look in the NinjaScript File Sharing section of our support forum as you may find what you are looking for there:

        Last, I'm also sharing a link to another forum post that reviews how to use prints to understand behavior and debug a script when the behavior is unexpected.
        Attached Files
        Paul H.NinjaTrader Customer Service


          Thank you!


            Hey Paul, I've been using the ExampleMADifferences indicator and it's great, so thank you. Just wondering if there is a way to reference this indicator within the strategy builder? For example, entering a position when the indicator number is greater or less than a specific value. Thanks in advance.


              Hello setardiffm,

              Welcome to the NinjaTrader forums!

              For an indicator to be visible in the Strategy Builder (or Market Analyzer) there must be a plot added with AddPlot() and a public Series<double> returning the Values[plot series index].

              The support article below provides sample code.
              Chelsea B.NinjaTrader Customer Service


                Thanks Chelsea!


                Latest Posts


                Topics Statistics Last Post
                Started by DayTradingDEMON, Yesterday, 08:54 AM
                12 responses
                Last Post NinjaTrader_Gaby  
                Started by reekotubbs, Today, 01:09 PM
                0 responses
                Last Post reekotubbs  
                Started by aligator, 06-05-2018, 01:25 AM
                60 responses
                Last Post aligator  
                Started by tony_28217, 06-15-2024, 12:55 PM
                7 responses
                1 like
                Last Post svikari
                by svikari
                Started by pvtrader, 07-01-2024, 09:02 AM
                4 responses
                Last Post Sparkyboy