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 know selected price type?

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

    How to know selected price type?

    I am writing indicator, which utilizes several price components. I want to give the user ability to choose which component to use as basic price data for analysis.

    To write indicator correctly, I must know not only exact data contained in "Input" but also exact source of these data. For example, is "Input" actually equal to "Open", "Close" or something else.

    I have searched all around product documentation but cannot find any variable or function to rely on. Strange enough, DataSeries does not support any text field to identify series name or the like.

    The only crazy idea i have so far, is consequently comparing "Input" point by point with every other series until unique coincedence is discovered. But it is incredibly ridiculous!

    #2
    You want to use Input[0]. Whichever price the user selects will be Input[0].
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I need to know exactly, which price type represents Input[0] in each particular case. Is it Close[0], Open[0] or something else? How can I find out, which exact price type user has selected in indicator settings?

      Comment


        #4
        Input takes whichever the user selects. Just run a comparison check.

        if (Input[0] == Close[0] && Input[0] != Open[0])
        // then you know exactly what it is
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          What if for given point we have:
          Close[0] = Open[0] = High[0] = Low[0] = some value?
          How can we distinguish exact Input[0] source in this case?

          Comment


            #6
            bzinchenko,

            You only need to make the distinction once. Highly unlikely every point you have will equate the same. Just run the check on several of the early bars. Save out the information and stop checking. The result is not going to change any time afterwards.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thank You. I have figured out myself same approach, as written in original post. I wanted to be sure that there is no other more elegant solution.

              Comment


                #8
                It appeared finally that class indicator has ready property "PriceType". So it is enough to get this property to know current user selection. Just if anybody else will need the same thing:

                PriceType type = this.PriceType;

                Sorry that i have orelooked it before. But i must admit that tech support is not very aware of class structure too!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                3 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                1 view
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                6 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Working...
                X