Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to programmatically add indicators to charts

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

    How to programmatically add indicators to charts

    The obvious way to add an indicator to a chart is just to popup the indicators dialog and add whatever you want, say EMA with a period of 5.

    But what if I want to bundle a bunch of indicators into a single indicator and then add that to a chart without adding each one individually? Is that possible?


    Say I want to create a custom indicator called EMABundle that contains EMA(5), EMA(20) and EMA(50). How would I do this? I know if I call EMA(5)[0] it just returns the value at the particular bar I'm looking at but I'd like the whole moving average drawn on the chart. Any help appreciated. Thanks,Peter

    #2
    Hello Pkinc,

    Thank you for your post.

    This is possible with custom programming. You'll notice that a lot of our prebuilt indicators contain multiple plots. You can see Bollinger for an example of this. Just "Set" each plot according to the indicator you would like to view.

    You can also save chart templates if you want to do this without having to code.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick response! I see from your reply that I used the wrong example so let me try again...

      What I'm really trying to do is bundle a bunch of CandleStickPatterns into a single indicator.

      Eg.

      CandleStickPattern(ChartPattern.BearishEngulfing);
      CandleStickPattern(ChartPattern.BearishHarami);
      CandleStickPattern(ChartPattern.BullishEngulfing);
      CandleStickPattern(ChartPattern.BullishHarami);

      but I don't think using a Set on a plot will work since the base indicator is not based on that. Any ideas?

      Comment


        #4
        Hi pkinoc,

        I wouldn't say you can combine multiple candlestick indicators into one. The one you're referencing is designed for one at a time. You can, however, identify multiple conditions on a chart and provide some visual cues when they're true.

        You define the rules for the candlestick patterns and then what to do once they're found. You can paint a bar or draw an arrow as two possible actions.

        You can access the conditions for candlestick patterns from the built-in indicator. Tools > Edit NinjaScript > Indicator > CandleStickPattern
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        566 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 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
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X