[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Sorting Arrays ( help )



PureBytes Links

Trading Reference Links

Anthony,

try this formula in VBScript; it works fine:

Filter = C>0;
periods=9;
pricechange=ROC(C,periods);
EnableScript("VBScript");
<%
Dim Temp
Dim i, j
pricechange = AFL("pricechange")
For i = 0 To UBound(pricechange) - 1
 For j = i To UBound(pricechange)
  If pricechange(i) > pricechange(j) Then '//  replace ">" with "<" for
descending order
   Temp = pricechange(i)
   pricechange(i) = pricechange(j)
   pricechange(j) = Temp
  End If
 Next
Next
AFL("P")   = pricechange
AFL("P0") = pricechange(0)
AFL("P1") = pricechange(1)
AFL("P2") = pricechange(2)
AFL("P3") = pricechange(3)
AFL("P4") = pricechange(4)
AFL("P5") = pricechange(5)
AFL("P6") = pricechange(6)
AFL("P7") = pricechange(7)
AFL("P8") = pricechange(8)
AFL("P9") = pricechange(9)
%>
AddColumn(P,"P",1.2);
AddColumn(P0,"P0",1.2);
AddColumn(P1,"P1",1.2);
AddColumn(P2,"P2",1.2);
AddColumn(P3,"P3",1.2);
AddColumn(P4,"P4",1.2);
AddColumn(P5,"P5",1.2);
AddColumn(P6,"P6",1.2);
AddColumn(P7,"P7",1.2);
AddColumn(P8,"P8",1.2);
AddColumn(P9,"P9",1.2);

Best regards,

Franco

----- Original Message -----
From: "Anthony Faragasso" <ajf1111@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, February 08, 2003 8:50 PM
Subject: Re: [amibroker] Sorting Arrays ( help )


> Is there anyone who can help with this......
>
> Anthony Faragasso wrote:
>
> >  I have found this Jscript for sorting in ascending Numeric order...Is
> >
> > this the proper function...and ....can anyone fill in the blanks.....
> >
> > periods=9;
> > pricechange=ROC(C,periods);
> >
> > EnableScript("JScript");
> >
> > <%
> > // Sorts records in ascending
> > // numeric value order
> > function sNumAsc(A, b) {
> >     return ((+A > +b) ? 1 : ((+A < +b) ? -1 : 0));
> > }
> >
> > %>
> >
> > Filter=1;
> > AddColumn(pricechange,"%change",1.2);
> >
> >
> > Thank you
> > Anthony
> >
> >
> >                    Yahoo! Groups Sponsor
>                         ADVERTISEMENT
>
>
> >
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>



Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/