Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars object question

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

    Bars object question

    Hello,

    Hello, I'm writing my first strategy and can't find in the reference guide the methods of the Bars object.

    Perhaps someone out there can help me.
    If I want to get the Open of a bar n barsago how would I do that?

    myBars[barsago].Open doesn't compile saying that myBars[barsago] is a double.
    If so what double is it? The Open, Close, High, Low, Volume?

    Thanks so much

    #2
    Hi The Kid,

    I would recommend reviewing this link and the associated tutorials first -



    Then,

    to get the open price for example for 4 bars ago, you can simply write

    Code:
     double myOpen = Open[4];

    Comment


      #3
      Hi there, I'm using more than one bar object in my strategy so calling Open on it's own will not be in the correct context for my secondary Bars

      I have gone through the material in the link already, but don't see a solution there.

      I have a feeling I am not using the correct Objet type.
      Here's one of the things I am doing:

      publicdouble sum(Bars x,int windowSize)
      {
      double theSum = 0;
      int i;

      if ( x.Count <= windowSize ){
      for (i = 0;i < windowSize;i++){
      theSum=theSum+ x[i];
      }
      }
      return theSum;
      }

      I am calling this function as follows:

      sum(BarsArray[1],2000);

      I was expecting x to be of type Bars and to have Open, Close, High, Low and Volume members, but it doesn't seem to have any of that.

      I don't see the Bars object explained in the help on the web. Quite possibly I am not looking in the right place. I guess I could resolve all this if you could point me to a comprehensive document with all objects and members explained.

      Thanks so much

      Comment


        #4
        Hi The Kid,

        Thank you for your patience

        Please review the two links here -





        To access the Close[0] of the first time series you can use -

        Code:
         Closes[0][0]
        To access the Open[1] of the second time series you can use -

        Code:
         Opens[1][1]

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        629 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        363 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        564 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X