Index number vs. Index price

 

When I print this code, it gives me the index number instead of the price. I want to get the price and not the index number. 

   double RSIValuesArray[6];
   ArrayInitialize(RSIValuesArray, 0);
   for(int i=0; i<6; i++)
     {
      RSIValuesArray[i] = iRSI(_Symbol, _Period, 14, PRICE_WEIGHTED, i);
     }

   double maximumValueRSIArray = ArrayMaximum(RSIValuesArray,WHOLE_ARRAY,1);
   Print("maximumValueRSIArray: ", maximumValueRSIArray);
 
  1.  double maximumValueRSIArray = ArrayMaximum
    ArrayMaximum
    returns an int, not a double.
  2. It gives you the index. Use it and read the value out of the array.
 
William Roeder #:
  1. ArrayMaximum returns an int, not a double.
  2. It gives you the index. Use it and read the value out of the array.

Thanks. It now works. Here is the final code for anyone needing it. Enjoy!

   double RSIValuesArray[6];
   ArrayInitialize(RSIValuesArray, 0);
   for(int i=0; i<6; i++)
     {
      RSIValuesArray[i] = iRSI(_Symbol, _Period, 14, PRICE_WEIGHTED, i);
     }

   int maximumValueRSIArray = ArrayMaximum(RSIValuesArray,WHOLE_ARRAY,1);
   Print("maximumValueRSIArray: ", maximumValueRSIArray);

   double indexPriceRSIArrayMaximum = RSIValuesArray[maximumValueRSIArray];
   Print("indexPriceRSIArrayMaximum: ", indexPriceRSIArrayMaximum);

 
maximumValueRSIArray = ArrayMaximum(RSIValuesArray,WHOLE_ARRAY,1);

If you want to exclude the value of the bar that's currently open (judging by how you're starting from index 1 and counting WHOLE_ARRAY), you should consider changing your for-loop:

for(int i=0; i<6; i++) // old

for(int i=1; i<6; i++) // new

This way, you can use ArrayMaximum with the default parameters

ArrayMaximum(RSIValuesArray,WHOLE_ARRAY,1); //old

ArrayMaximum(RSIValuesArray); // new
 
Alexander Martinez #:

If you want to exclude the value of the bar that's currently open (judging by how you're starting from index 1 and counting WHOLE_ARRAY), you should consider changing your for-loop:

This way, you can use ArrayMaximum with the default parameters

Thanks. That's elegant. Will use it.

 

Price indices are represented as index numbers, number values that indicate relative change but not absolute values (i.e. one price index value can be compared to another or a base, but the number alone has no meaning).

Price indices generally select a base year and make that index value equal to 100.

Reason: