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 two data series inputs

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

    indicator with two data series inputs

    Hallo,

    I would like to script an indicator that does calculations with two
    data series inputs, such as divergence checking or correlation coefficient calculation. The standard procedure would be to add a second specified dataseries
    within the indicator script. However, I would like to keep the indicator general
    and would like to apply the indicator to the two dataseries which I want to specify
    individually when I add it to a chart or a strategy.
    How can this be accomplished?

    #2
    Stephan, have you tried specifying the secondary instrument in the instrument's settings as a string? The pairs indicators in the file-sharing section demonstrate this concept.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by Stephan123 View Post
      Hallo,

      I would like to script an indicator that does calculations with two
      data series inputs, such as divergence checking or correlation coefficient calculation. The standard procedure would be to add a second specified dataseries
      within the indicator script. However, I would like to keep the indicator general
      and would like to apply the indicator to the two dataseries which I want to specify
      individually when I add it to a chart or a strategy.
      How can this be accomplished?
      You specify the two instruments as strings in the input dialog, add two Bars objects, one for each instrument, then code to ignore updates from the primary Bars object.

      Code:
      if (BarsInProgress == 0) return;
      will ignore any updates from the instrument on the chart, so your calculations will only apply to the other instruments that you have added.

      Comment


        #4
        Secondary instrument for indicators

        Originally posted by NinjaTrader_Austin View Post
        Stephan, have you tried specifying the secondary instrument in the instrument's settings as a string? The pairs indicators in the file-sharing section demonstrate this concept.
        I was already thinking about that, but of course there is the possibility to
        do false inputs causing the script to faile. I'd rather prefer to create a second
        input series field to choose the 2nd dataseries in a save and comfortable way
        via mouse clicks instead of typing a string. Is there a way to do that and to create
        a 2nd dataseries input field within the indicator dialog box?

        Comment


          #5
          Originally posted by koganam View Post
          You specify the two instruments as strings in the input dialog, add two Bars objects, one for each instrument, then code to ignore updates from the primary Bars object.

          Code:
          if (BarsInProgress == 0) return;
          will ignore any updates from the instrument on the chart, so your calculations will only apply to the other instruments that you have added.
          What's the reason behind ignoring updates from the primary dataseries?
          Does it only play a role if updateonbarclose=false?
          Does it have to do with data synchronisation-in that case-would I have to worry about sync. between dataseries 2 and dataseries 3 as well?

          Comment


            #6
            Originally posted by Stephan123 View Post
            I was already thinking about that, but of course there is the possibility to
            do false inputs causing the script to faile. I'd rather prefer to create a second
            input series field to choose the 2nd dataseries in a save and comfortable way
            via mouse clicks instead of typing a string. Is there a way to do that and to create
            a 2nd dataseries input field within the indicator dialog box?
            This would unfortunately not be supported Stephan, the way to go would be using a string user input here as demonstrated in the scripts floating around in the sharing Austin cited in a prior post.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by Stephan123 View Post
              What's the reason behind ignoring updates from the primary dataseries?
              Does it only play a role if updateonbarclose=false?
              Does it have to do with data synchronisation-in that case-would I have to worry about sync. between dataseries 2 and dataseries 3 as well?
              In your initial question, this is what you stated:

              ... However, I would like to keep the indicator general
              and would like to apply the indicator to the two dataseries which I want to specify
              individually when I add it to a chart or a strategy
              .
              The primary Bar object is always the symbol on the chart. That is the way to ignore the symbol on the chart, so that your two input symbol Bar objects are the only ones driving the indicator.

              Comment


                #8
                Originally posted by Stephan123 View Post
                I was already thinking about that, but of course there is the possibility to
                do false inputs causing the script to faile. I'd rather prefer to create a second
                input series field to choose the 2nd dataseries in a save and comfortable way
                via mouse clicks instead of typing a string. Is there a way to do that and to create
                a 2nd dataseries input field within the indicator dialog box?
                To do that you would have to use an enum, limiting you to only the symbols in the enum structure. You would key of the enum selection to generate the correct text to input into your Add() statement.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by TraderJA, Today, 12:06 AM
                0 responses
                3 views
                0 likes
                Last Post TraderJA  
                Started by SnailHorn, Yesterday, 10:49 PM
                0 responses
                7 views
                0 likes
                Last Post SnailHorn  
                Started by naanku, Yesterday, 07:25 PM
                0 responses
                8 views
                0 likes
                Last Post naanku
                by naanku
                 
                Started by milfocs, Yesterday, 07:23 PM
                0 responses
                6 views
                0 likes
                Last Post milfocs
                by milfocs
                 
                Started by PaulMohn, Yesterday, 06:59 PM
                0 responses
                8 views
                0 likes
                Last Post PaulMohn  
                Working...
                X