Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get Opening market price

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

    Get Opening market price

    I want to get the price at a given time, in the example 11:30 (opening of the market ).
    My code does not work....

    private DataSeries myDataSeries; //in variables
    .....

    myDataSeries = new DataSeries(this); //in initialize method
    .....
    int BarsAgoOpenPrice = Bars.GetBar(new DateTime(2008,04,14,11,30,0,0));
    OpenPrice = Close [BarsAgoOpenPrice];

    Do i have also to check with myDataSeries.ContainsValue(BarsAgoOpenPrice) if there is a value?
    Thx

    #2
    GetBar returns the absolute index of a bar and not the "barsAgo" index which you would need to stuff into Close[barsAgo].

    Comment


      #3
      So what can i use with getbar to have the price?

      Comment


        #4
        You need to apply some math to convert the absolute index to the barsAgo index like (pseudo code):
        int barsAgo = CurrentBar - GetBar(new DateTime(2008,04,14,11,30,0,0))

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        576 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
        553 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