Login Page - Create Account

Support Board


Date/Time: Mon, 23 Dec 2024 11:59:31 +0000



Post From: "For" Loop to find the lowest price in an array of bars on a chart

[2015-09-17 22:45:31]
User126996 - Posts: 30
I'm trying to find the lowest price in an array of bars on the chart. I'm using a pointer that is in the SCInputRef to determine how many bars or indices to look back.



if (sc.SetDefaults)
{

PivotLength.Name = "Pivot Length";
PivotLength.SetInt(5);
PivotLength.SetIntLimits(1, MAX_STUDY_LENGTH);


return;
}

SCDateTime LowDT;
int Arr[] = { sc.BaseData[SC_LOW][sc.Index - PivotLength.GetInt()] };
int i;
int Low = Arr[0];

for (i = 0; i >= sc.BaseData[SC_LOW][sc.Index - PivotLength.GetInt()]; i++)
{
if (Arr[i] < Low)
  {
   Arr[i] = Low;
   Low = Arr[i];
   LowDT = sc.BaseDateTimeIn[sc.Index - PivotLength.GetInt()];
  }
}


Can you give some advice to where I'm going wrong? I'm new to the platform. It's quality though!