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

Re: [amibroker] Sorting Arrays ( help )



PureBytes Links

Trading Reference Links

Anthony,

now I understood what you want to achieve. Sorry, but if I'm not wrong, this
is not possible because by loops you can iterate into any array of one
symbol, but not through a database.

Best regards,

Franco

----- Original Message -----
From: "Anthony Faragasso" <ajf1111@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, February 09, 2003 6:49 AM
Subject: Re: [amibroker] Sorting Arrays ( help )


> Franco,
>
> Thank you for the code..but I am confused as to the result output..why
> the 11 columns and the only column that is sorted is the ticker column
> in ascending order...it seems that this column takes precedence over all
> other columns....
>
> If I run the exploration;
>
> pricechange=ROC(C,9);
> filter=1;
> Addcolumn(pricechange,"%change",1.2);
>
> The results of this explore are sorted by the Ticker column...now if I
> click on the %change column the results are sorted by the %change
> column...with the highest %change to the worst.....This is what I would
> like to achieve with the first explore....maybe it is not possible.
>
> Thank you
> Anthony
>
> Franco Fornari wrote:
>
> >  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/
> > >
> > >
> >
> >
> >
> >                    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/