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

Indicator with 3 diferents SMA

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

    Indicator with 3 diferents SMA

    Can I create a Indicator with 3 configurable EMAs at the same time?. I tried to replicate the EMA indicator but it does not draw any of the three, I must be repeating the same order so it does not draw any of them.

    There is the possibilty to configure each one in some temporality in the same indicator?. I would like to use it to later get it draw a circle or diamond at the crossing point

    Thanks in advance.

    #2
    Hello BIOK.NT,

    Thank you for your post.

    To add an indicator to an indicator and plot it, you can use AddPlot() then in OnBarUpdate() assign the Value for the plots to the EMA.

    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    AddPlot(Brushes.Blue, "EMA1");
    }
    }
    
    protected override void OnBarUpdate()
    {
    Value[0] = EMA(14)[0];
    }
    AddPlot() - https://ninjatrader.com/support/help...t8/addplot.htm
    Value[] - https://ninjatrader.com/support/help.../nt8/value.htm

    Please let me know if you have any further questions. ​
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply.

      I have tested the logic and it works perfectly, if I try with only one EMA.

      I have tried using your AddPlot link, because what I need is to add 3 EMA lines with different periods draws on the same chart.

      When using the "Indicator which adds three value series" section. I use the Values concept but I would like to be able to make the EMA periods configurable. Is there a possibility to modify the code toI get them to appear in the selectable?.

      If I use Value, as you gave as an example in your answer, it only draws one EMA on the chart, even if I configure other lines with

      Value[0] = EMA(5)[0]
      Value[1] = EMA(9)[0]
      Value[2] = EMA(14)[0]

      I add three diferents AddPlot too on the Set.Defaults

      ​Thank you verty much in advance for the patience.

      Comment


        #4
        Hello,

        You would configure the periods as user defined inputs. You can do this manually or from the indicator wizard.

        User defined inputs - https://ninjatrader.com/support/help...d_input_pa.htm

        Also, my apologies for not being clearer. Since you have more than one plot, you can use Values. The AddPlot() page from my previous post demonstrates how to use the Values array when you have more than one plot.

        Values - https://ninjatrader.com/support/helpGuides/nt8/values.htm
        Gaby V.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        5 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        12 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        13 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,982 views
        3 likes
        Last Post jhudas88  
        Working...
        X