Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Referencing Custom Indicator Values

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

    Referencing Custom Indicator Values

    I've been using a custom example indicator (ExampleMADifferences) provided by you guys that calculates the number of ticks between two moving averages and that value is displayed in text in the top right of the chart.

    I'm very much a novice with programming in general, so I was looking if I could get some help referencing that indicator's value in the strategy builder/data box. I believe I need to use the AddPlot function but to be honest, I cannot figure it out.

    Ultimately, my goal is to use the indicator within the strategy builder as a condition to enter positions based on the value that the indicator displays on the chart.

    I hope this makes sense. Any help would be greatly appreciated.


    #2
    Hello setardiff,

    Thank you for your post.

    I recommend checking out this article on getting started with NinjaScript.



    Indicators will only be accessible in the Strategy Builder if the indicator contains a plot and a value is assigned to that plot. So you are correct that you would need to use AddPlot().

    The Strategy Builder would then be able to access that plot's value in the Conditions and Actions screen.

    AddPlot() can be used to add a plot to the script. Then, you could assign a value to that plot by calling Value[0] = 'x', where x is the value you are assigning.

    See this help guide page for more information about AddPlot() and sample code: https://ninjatrader.com/support/help...t8/addplot.htm

    Let me know if I may assist further.​

    Comment


      #3
      Thanks Gaby.

      I will definitely read through those articles. But just to be sure, given the indicator only displays a number, is that still plottable? As I would think plotting something like a moving average uses the price data in reference to where current price is, but this is simply a numerical value, not related to the price data, so I'm confused as to what would be plotted?

      My understanding is minimal at best so I appreciate you bearing with me.

      Comment


        #4
        Hello setardiff,

        Yes, it needs to be number to be plotted. In particular, the Value collection is a series of doubles.



        Whatever value you would like to access from the indicator in the Strategy Builder is what would need to be plotted.


        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services.

        You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:

        https://ninjatraderecosystem.com/sea...mming-services

        You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

        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 companies and services 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.

        Let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        626 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        359 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        562 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        567 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X