Login Page - Create Account

Support Board


Date/Time: Wed, 08 May 2024 04:18:25 +0000



Post From: Array Bounds violation in dynamic arrays

[2019-04-27 06:14:42]
User255315 - Posts: 127
Hi SC!
If its possible for you to have just a quick look at the following loop in which i populate a dynamic array with VaP for the range of the day through sc.VolumeAtPriceForBars. I am fairly certain that this loop is throwing the exception. Any suggestions or guidelines regarding this are welcome.


s_VolumeAtPriceV2* p_fill= NULL;
  
  int ProfileIndex = 0;
  int PriceIndex = 0;
  int ht = sc.VolumeAtPriceForBars->GetSizeAtBarIndex(Index)-1;
  
  range[Index] = ht;
    
  for (int KeyIndex = 0;KeyIndex < ht+1; KeyIndex ++)
  {
      sc.VolumeAtPriceForBars->GetVAPElementAtIndex(Index, KeyIndex, &p_fill);

      //verify the pointer is not a null, otherwise an exception will occur
      if (p_fill)
      {
        
        float value= p_fill->Volume;
        p_VAP[KeyIndex]= value;
        //youre storing VAP in dyn mem
      }
    
  }

This is the corresponding error message:
Warning: The Custom DLL study "daily-mod.scsf_SelfContainedVB" has just caused a CPU exception. | 2019-04-26 17:11:59 *
Warning: This Custom DLL study may cause Sierra Chart to be unstable until you remove the study from your chart and restart Sierra Chart. | 2019-04-26 17:11:59 *

Thanks in advance!