Announcement

Collapse
No announcement yet.

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.

    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.

      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.

          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);
                }

                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 Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  579 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  554 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X