• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get last Bar object

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

    Get last Bar object

    I need to get latest bar object of some specified index in multi-timeframe strategy.
    Lets say I have 3 time-frames:
    //main time-frame, the one to which strategy is attached.
    Add(PeriodType.Minute, 3); //added in onIntialize
    Add(PeriodType.Minute, 1); //added in onIntialize

    How do I get latest Bar object for 3rd time-frame?
    I can obtain Closes[2][0],Highs[2][0], Lows[2][0], Opens[0],Times[2][0], Volumes[2][0], which is basically information stored in the object. But I need Bar object- it's just a matter of usage convenience. I could easily live without it, but since you do have Bar class in framework, I thought it might be possible. I just don't seem to be able to find how could I do that.
    I would assume that it should be accessible through Bars object and you do have
    GetDayBar function in this class. But its name suggests something different.
    So would BarsArray[2].GetDayBar[0] get me latest bar for 1 minute time-frame?

    #2
    Originally posted by Andreano View Post
    I need to get latest bar object of some specified index in multi-timeframe strategy.
    Lets say I have 3 time-frames:
    //main time-frame, the one to which strategy is attached.
    Add(PeriodType.Minute, 3); //added in onIntialize
    Add(PeriodType.Minute, 1); //added in onIntialize

    How do I get latest Bar object for 3rd time-frame?
    CurrentBars[2]

    Comment


      #3
      CurrentBars[2] would return me int, which is not a Bar object. I need to get hold of latest Bar object on 3rd time-frame, instance of class that implements IBar interface, like the one reutrned by Bars.GetDayBar(). I don't need it's index in sequence of bars.

      Comment


        #4
        BarsArray[2].Get(0) would get me latest Bar object
        Question is closed. Shame on me. Bring my apology for my blindness.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by usero86, Today, 04:28 AM
        0 responses
        7 views
        0 likes
        Last Post usero86
        by usero86
         
        Started by bohenriksen, Today, 04:00 AM
        0 responses
        4 views
        0 likes
        Last Post bohenriksen  
        Started by Derjan, Today, 03:09 AM
        0 responses
        5 views
        0 likes
        Last Post Derjan
        by Derjan
         
        Started by CDXTrader, Today, 12:29 AM
        0 responses
        7 views
        0 likes
        Last Post CDXTrader  
        Started by TopGun13, Yesterday, 10:35 PM
        0 responses
        5 views
        0 likes
        Last Post TopGun13  
        Working...
        X