Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing Heiken Ashi bar properties

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

    Accessing Heiken Ashi bar properties

    Hi,
    I have 1 minute Heiken Ashi bars on my chart.
    In an indicator, I am trying to determine the type of bars on the chart.
    How can I access the property that shows that they are minute type bars? The only applicable property that I can see is BaseBarsPeriodType which seems to be unaccessable.
    Thanks,
    iq

    #2
    Hello iq200,

    You can use the following to access the BaseBarsPeriodType, this needs to be accessed after bars have been loaded so State.DataLoaded or later, this cannot be used in earlier states.

    Bars.BarsPeriod.BaseBarsPeriodType

    Comment


      #3
      Hi Jesse - I am not sure what you mean by "after the bars have been loaded" as the bars are Heiken Ashi bars are the primary bar type already on the chart. Why can I not then access the bar properties in State.Configure?
      I'm trying to access the bar timeframe (which is a user configurable property in my indicator) so that so that I can load volumetric bars later in State.DataLoaded.
      Is this not possible?
      Thanks,
      iq
      Last edited by iq200; 08-06-2024, 10:56 AM.

      Comment


        #4
        Hello iq200,

        In your script the bars are only loaded once you reach State.DataLoaded, if the intention was to use this value for configuration in earlier states that is not possible. If the intention was to use that with AddDataSeries that will not work, AddDataSeries and the other methods like AddVolumetric cannot be dynamic, you need to type in the values for that to work correct.

        Comment


          #5
          Hi Jesse -
          I can set the timeframe dynamically in State.Configure for other bar bar types such as standard 1 minute bars and then load the bars using this dynamic setting in DataLoaded.
          Strangely, I can see in the VS debugger that the bars are 1 minute by examining the BaseBarsPeriodType property in State.Configure. I just can't access it in the code!
          It's a bit frustrating and bit of a shame that Heiken Ashi is coded in such a way that you cant!
          Regards,
          iq
          Last edited by iq200; 08-06-2024, 11:15 AM.

          Comment


            #6
            Perhaps I was doing it incorrectly using a different property to what I intended to use before but I have just re-tried it and I can now get it to work as I described and wanted, above!
            Thanks for your help anyway!

            Comment


              #7
              Hello iq200,

              Its specifically documented to avoid that because that will not work in all use cases, as such we cannot advise any kind of dynamic use for adding data. With the Bars object that is only available once bars are loaded in State.DataLoaded, this is also documented in the help guide.

              Warning: This property should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded


              Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided.



              Comment


                #8
                From a coding perspective, I can understand why it is not recommended. Nevertheless, thanks for the prompt help and warning!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                601 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                347 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                559 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                558 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X