Thread: Ask!
View Single Post
  #708 (permalink)  
Old 08-03-2007, 08:01 PM
SaxMan's Avatar
SaxMan SaxMan is offline
Member
 
Join Date: Mar 2006
Posts: 27
SaxMan is on a distinguished road
Error Fixed

Quote:
Originally Posted by SaxMan View Post
Hi all,

I thought I had my answers with the following code:

Code:
double range[5];
  for(int i=1;i<5;i++)
   {
  range[i]={High[i]-Low[i]};
  int Max=ArrayBsearch(range,10,WHOLE_ARRAY,1,MODE_ASCEND);
  double MaxRange=(High[Max]-Low[Max])/Point;
  } 
  Print("Max Range: ",MaxRange," found at index: ",Max);
But it still just returns the last index not the largest range index.

Any further help would be appreciated.
SaxMan
Here's the fix:
Code:
double range[5];
  for(int i=1;i<5;i++)
   {
  range[i]={High[i]-Low[i]};
  int Max=ArrayMaximum(range);
  double MaxRange=(High[Max]-Low[Max])/Point;
  }
  
  Print("Max Range: ",MaxRange," found at index: ",Max);
This could be used to get the highest/lowest(using ArrayMinimum(range)) of the array to compare any variables.

Hope this helps,
SaxMan
Reply With Quote