Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar price collections in GetMinMaxValues()

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

    Bar price collections in GetMinMaxValues()

    I am trying to get the values of High[0] and Low[0] in GetMinMaxValues() but an ArgumentOutOfRangeException is triggered. I have tried to get Open[0] and Close[0] but I couldn't either.

    Is it possible to access these bar price collections in GetMinMaxValues()? I have noticed that CurrentBar is always -1 inside the scope of that function. Does anybody know why?

    #2
    >> Is it possible to access these bar price collections in GetMinMaxValues()?
    No. Also: unfortunately this is beyond the scope of what we provide support for.

    Comment


      #3
      Originally posted by windcatcher View Post
      I am trying to get the values of High[0] and Low[0] in GetMinMaxValues() but an ArgumentOutOfRangeException is triggered. I have tried to get Open[0] and Close[0] but I couldn't either.

      Is it possible to access these bar price collections in GetMinMaxValues()? I have noticed that CurrentBar is always -1 inside the scope of that function. Does anybody know why?
      Notwithstanding the support guy's reply, there's nothing to prevent others from providing a more helpful answer. Here's an example I've seen that scans through highs and lows:

      Code:
       
      public override void GetMinMaxValues(ChartControl chartControl, ref double min, ref double max)
      {
         base.GetMinMaxValues(chartControl, ref min, ref max);
       
         int bars = base.ChartControl.BarsPainted;
         Exception caughtException;
       
         while (bars >= 0) {  
            int index = base.ChartControl.LastBarPainted -base.ChartControl.BarsPainted + 1 + bars;
            if (base.ChartControl.ShowBarsRequired || ((index - base.Displacement) >= base.BarsRequired)) {
               try {
                  double thisHigh =  dsHigh.Get(index);
                  double thisLow =  dsLow.Get(index);
                  if ((!double.IsNaN(thisHigh)) && (index>0)) {
                     if (thisHigh>max) max=thisHigh;
                     if (thisHigh<min) min=thisHigh; 
                  }
                  if ((!double.IsNaN(thisLow)) && (index>0)) {
                     if (thisLow>max) max=thisLow;
                     if (thisLow<min) min=thisLow; 
                  }
               }
               catch (Exception exception) { caughtException=exception; }
            }
            bars--;
         }
      }
      Hope that helps.
      -Alex

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      581 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      338 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
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X