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

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 set2win, 08-04-2021, 09:23 AM
        39 responses
        998 views
        0 likes
        Last Post WaleeTheRobot  
        Started by md4866, Today, 08:15 PM
        0 responses
        1 view
        0 likes
        Last Post md4866
        by md4866
         
        Started by mjbatts91, Yesterday, 04:48 PM
        2 responses
        23 views
        0 likes
        Last Post mjbatts91  
        Started by pibrew, Today, 06:10 PM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by actualfacts.2021, 07-25-2021, 03:11 PM
        8 responses
        1,184 views
        0 likes
        Last Post linkcou
        by linkcou
         
        Working...
        X