Hi, I am trying to sort a data array using the sort functions available in the manual. However, i cannot get it to sort and just returns zero on the plot. Could someone please bump me in the right direction?
Code
function run()
{
set(LOGFILE);
BarPeriod = 15;
StartDate = 2020;
EndDate = 2021;
LookBack = 1440;
asset("EUR/USD");
var* Data = series(price());
var* Ranks;
int Length = 50;
int A2V = sortRank(var* Ranks, var* Data, int Length);
int A3V = sortIdx(var* Data, int Length);
int A4V = sortData(var* Data, int Length);
}
sortData error is "cannot convert void to long". commenting out the left hand side eliminates the error. Is there a way to return the sortData into an array? sortRank and sortIdx return 0 on the plots.
Only findIdx returns a value other than 0. "Returns the index of the highest Data element below or equal to Value, or -1 when no such element was found. ". Ok!.
please bump me! for i have sinned and i know nothing.
Last edited by degenerate_762; 05/18/2212:22.
Re: Help with sorting data array
[Re: Petra]
#485968 05/18/2211:5105/18/2211:51
@Petra, I see that sortIdx, sortRank , and findIdx return int* / int. Makes sense for plot to return a constant. Ok. what does sortData return? int, var, vars ? i get the error cannot convert void to long. also if they return integers, how would i get the sorted array? it returns an integer while the sorted array of size length is of interest.
Re: Help with sorting data array
[Re: Grant]
#485969 05/18/2211:5305/18/2211:53