Gamestudio Links
Zorro Links
Newest Posts
Please consider
by DriftWood
Today at 03:10
Draw stuff from other thread
by Superku
Yesterday at 23:25
Partial fills with MT4 in live trading?
by Sphin
Yesterday at 19:06
New Zorro version 1.83
by DdlV
Yesterday at 13:55
Cubemaps losing mipmaps
by Quad
Yesterday at 12:37
Zorro & virtual desktops & Installation
by jcl
Yesterday at 10:59
ccyStrength() only working for some Currencies
by sdh309795gaas
07/18/18 05:02
AUM Magazine
Latest Screens
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Forgotten Tales - Demo version
RPG PARTY
Who's Online
16 registered (alibaba, 3run, kvm, jenGs, Denn15, Hopoe, oligodar, DJ_Algo, 4 invisible), 505 Guests and 3 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
DJ_Algo, tang, stuvwx210277, refltr, hillab
18002 Registered Users
Topic Options
Rate This Topic
#464838 - 03/14/17 18:16 sortIdx
hatten Offline
Newbie

Registered: 07/01/16
Posts: 39
When using sortIdx I run into the problem that this function apparently checks the lookback period and yields and error if the number of elements of the array you wish to sort exceeds the lookback period. However I do wish to sort an array that is not a time series and whose dimension is unrelated to lookback issues. This function should be in file functions.c as it is declared in function.h. Unfortunately function.c is not part of the distribution, otherwise it would be easy to just copy the code for sortIdx and remove checklookback command, which I assume is the problem. Anyone has a code snippet for sorting as sortIdx does? The standard qsort c++ function is different as it rearranges the elements of the original array which I don't want.

Top
#470424 - 01/13/18 16:09 Re: sortIdx [Re: hatten]
sdh309795gaas Offline
Junior Member

Registered: 12/07/14
Posts: 99
Same question here!


This doesn't work:


function main()
{
int n;
var myarray[4] = {1.5, 2.3, 0.1, 0.001};

int Idx = sortIdx(myarray, 4);

for(n=0, n < 4, n++)
{
printf("n%dth Index = %d",n,Idx[n]);
}


}

Top
#470439 - 01/14/18 20:19 Re: sortIdx [Re: sdh309795gaas]
oligodar Online
Newbie

Registered: 12/08/13
Posts: 14
This code works for me:

Code:
function main(){
	int n;
	var myarray[4] = {1.5, 2.3, 0.1, 0.001};
	int* Idx = sortIdx(myarray, -4);
	for(n=0; n < 4; n++){
	    printf("\n%dth Index = %d",n,Idx[n]);
	}
}




in zorro 1.744


Edited by oligodar (01/14/18 20:24)

Top
#470447 - 01/15/18 10:58 Re: sortIdx [Re: oligodar]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26397
Loc: Frankfurt
AFAIK, sortIdx does not check the lookback period and the number of elements does not matter. Maybe you were using a very old Zorro version.

Top



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de