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 kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        127 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        85 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        85 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X