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

Determine input price type

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

    Determine input price type

    Hi. Is it possible to know the input price type? I just want to print out the input series name. If Close then "Close", if High then "High" etc.

    #2
    Hello digibob,

    Thanks for your post.

    I'm looking in to this and will update this post when I have further information.

    Thanks in advance for your patience.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello digibob,

      Thanks for your patience.

      Here is something you can work with:

      Code:
      if (CurrentBar == 0)
                  {
                      Print ("price Type is:");
                      if (Input[0] == Median[0])
                          Print ("Median");
                      else if (Input[0] == Typical[0])
                          Print ("Typical");
                      else if (Input[0] == Weighted[0])
                          Print ("Weighted");
                      else if (Input[0] == High[0])
                          Print ("High");
                      else if (Input[0] == Low[0])
                          Print ("Low");
                      else if (Input[0] == Open[0])
                          Print ("Open");
                      else
                          Print ("Close");
                  }

      I'm checking to see if there isn't a more elegant solution and if I find anything I will update this thread.
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Hi Paul. Thanks for the suggestion. It would work as long as no two are the same. If the Close equals the High for example, it may fail.

        I take it there's no built in property or method such as InputPriceType, .GetName, something like that.

        Well, thanks anyway.

        Comment


          #5
          Hello digibob,

          Thanks for your reply.

          You are correct and perhaps, for now, you might sample 2-3 bars to validate or as many as you need to feel like you have verified the price type.

          I'm still looking for another solution though.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by digibob View Post
            Hi Paul. Thanks for the suggestion. It would work as long as no two are the same. If the Close equals the High for example, it may fail.

            I take it there's no built in property or method such as InputPriceType, .GetName, something like that.

            Well, thanks anyway.
            Remove the "else" clauses. Every possibility will then be tested.

            Comment


              #7
              Thanks guys.
              Removing the 'else' will not prevent a wrong call when two types are same value.
              I added a custom 'price type' enum property that has to be set alongside the actual price type. It's not more elegant than Paul's suggestion but it works for now.

              Comment


                #8
                Hello digibob,

                Thanks for your reply.

                This is what I was looking for:

                else if (State == State.DataLoaded)
                {
                PriceSeries priceSeries = Inputs[0] as PriceSeries;
                if (priceSeries != null)
                Print("PriceType: " + priceSeries.PriceType);
                }
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Paul, sorry for the late reply. Yes, this is it. Many thanks.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by agclub, 04-21-2024, 08:57 PM
                  5 responses
                  32 views
                  0 likes
                  Last Post agclub
                  by agclub
                   
                  Started by ESHunter, Today, 08:06 PM
                  2 responses
                  16 views
                  0 likes
                  Last Post ESHunter  
                  Started by ETFVoyageur, 05-07-2024, 07:05 PM
                  19 responses
                  150 views
                  0 likes
                  Last Post ETFVoyageur  
                  Started by ETFVoyageur, Yesterday, 10:13 PM
                  3 responses
                  26 views
                  0 likes
                  Last Post ETFVoyageur  
                  Started by ETFVoyageur, Yesterday, 12:52 AM
                  3 responses
                  33 views
                  0 likes
                  Last Post ETFVoyageur  
                  Working...
                  X