PureBytes Links
Trading Reference Links
|
Has anyone coded a bubble sort routine in AB yet.
Assistance will be greatly appreciated.
Here is my malfunctioning attempt to use it to find the
median.
Yes, I know AB has a MEDIAN, I'm trying to get the sort
routine down:
SetBarsRequired(1000000,1000000);Y=C;//sort
closesN=5;CH=0;csMEDIAN=0;
for(i=6;i<BarCount;i++){//outermost FOR
bracket
do {//do
bracket for(j=0;j<N;j++) {//inner
FOR CH=0;//"change" set to zero
<FONT color=#0000ff
size=2> E1[i]=Y[i-j]; E2[i]=Y[i-j-1]; if(E1[i]>E2[i])//change
condition { Y[i-j]=E2[i]; Y[i-j-1]=E1[i]; CH=1;//change
was
made } }//inner
FOR }//do bracket while(CH!=0);
<FONT color=#0000ff
size=2> Mid[i]=int(N/2); csMEDIAN=Y[i-2];//for 5 bar
median
}//outermost FOR
bracketGraphXSpace=5;
<FONT color=#0000ff
size=2>Plot(Y,"Y",4,8);Plot(csMEDIAN,"csMEDIAN",0,8|styleOwnScale);Plot(mid,"mid",0,1|styleOwnScale);Plot(CH,"CH",5,1|styleOwnScale);
Thanks,
-CS
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
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
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|