SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TradeStation - Why No thread for this mega product

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: Michael Watkins who wrote (122)11/2/2001 5:09:21 PM
From: MechanicalMethod  Read Replies (1) of 147
 
I need a bubble sort routine to sort the last 4 values in myArray by transferring sorted results to another array.

var: ai(0), si(0); {ai+si index the arrays}
array: myArray[9999,0](0), sorted[3,0](0);

if myCondition then being
ai=ai+1;
myArray[ai,0]=c;
end;

I need to sort the 4 most recent myArray values in descending [or ascending] order. Here is the unsorted list that needs to be sorted:

myArray[ai,0];
myArray[ai-1,0];
myArray[ai-2,0];
myArray[ai-3,0];

Then store the sorted values indexed within the array named sorted so I can access them using the index si:

sorted[si,0];
sorted[si-1,0];
sorted[si-2,0];
sorted[si-3,0];
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext