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

Re: [amibroker] Re: YEARLY STOCK PERFORMANCE



PureBytes Links

Trading Reference Links

Here is another version much like Dick's that calculates percentage changes but also colors the cells to visually help spot rotation. It may be a little too Christmas colored for you but tis the season. I wrote this when I first started with AB so it could be cleaned up quite a bit.

//Use to see percentage change over time

Wk1     = C / Ref(C, -5) * 100 - 100;
Wk2     = C / Ref(C, -10) * 100 - 100;
Wk3     = C / Ref(C, -15) * 100 - 100;
Wk4     = C / Ref(C, -20) * 100 - 100;
Wk5     = C / Ref(C, -25) * 100 - 100;
Wk6     = C / Ref(C, -30) * 100 - 100;
Wk7     = C / Ref(C, -35) * 100 - 100;
Wk8     = C / Ref(C, -40) * 100 - 100;
Qtr       = C / Ref(C, -65) * 100 - 100;
Qtr2     = C / Ref(C, -130) * 100 - 100;
Year1   = C / Ref(C, -252) * 100 - 100;

UpWk1    =IIf(Wk1>0,colorBlack,colorWhite);
DnWk1    =IIf(Wk1<0,colorRed,colorLime);
UpWk2    =IIf(Wk2>0,colorBlack,colorWhite);
DnWk2    =IIf(Wk2<0,colorRed,colorLime);
UpWk3    =IIf(Wk3>0,colorBlack,colorWhite);
DnWk3    =IIf(Wk3<0,colorRed,colorLime);
UpWk4    =IIf(Wk4>0,colorBlack,colorWhite);
DnWk4    =IIf(Wk4<0,colorRed,colorLime);
UpWk5    =IIf(Wk5>0,colorBlack,colorWhite);
DnWk5    =IIf(Wk5<0,colorRed,colorLime);
UpWk6    =IIf(Wk6>0,colorBlack,colorWhite);
DnWk6    =IIf(Wk6<0,colorRed,colorLime);
UpWk7    =IIf(Wk7>0,colorBlack,colorWhite);
DnWk7    =IIf(Wk7<0,colorRed,colorLime);
UpWk8    =IIf(Wk8>0,colorBlack,colorWhite);
DnWk8    =IIf(Wk8<0,colorRed,colorLime);
UpQtr      =IIf(Qtr>0,colorBlack,colorWhite);
DnQtr      =IIf(Qtr<0,colorRed,colorLime);
UpQtr2    =IIf(Qtr2>0,colorBlack,colorWhite);
DnQtr2    =IIf(Qtr2<0,colorRed,colorLime);
UpYear1  =IIf(Year1>0,colorBlack,colorWhite);
DnYear1  =IIf(Year1<0,colorRed,colorLime);


AddTextColumn( FullName(), "FullName" );
//AddTextColumn(IndustryID(1) ," Industry Sector ", 25.0, colorWhite, colorBlue);
AddColumn(Wk1,    "1Wk%",  1.2, UpWk1, DnWk1);
AddColumn(Wk2,    "2Wk%",  1.2, UpWk2, DnWk2);
AddColumn(Wk3,    "3Wk%",  1.2, UpWk3, DnWk3);
AddColumn(Wk4,    "4Wk%",  1.2, UpWk4, DnWk4);
AddColumn(Wk5,    "5Wk%",  1.2, UpWk5, DnWk5);
AddColumn(Wk6,    "6Wk%",  1.2, UpWk6, DnWk6);
AddColumn(Wk7,    "7Wk%",  1.2, UpWk7, DnWk7);
AddColumn(Wk8,    "8Wk%",  1.2, UpWk8, DnWk8);
AddColumn(Qtr,      "1 Qtr%",   1.2,  UpQtr, DnQtr);
AddColumn(Qtr2,    "2 Qtr%",   1.2,  UpQtr2,DnQtr2 );
AddColumn(Year1,  "1 Year%", 1.2,  UpYear1,DnYear1);

Filter=1;

SetSortColumns(-15,-14,-13,-12,-11,-10,-9,-8,-7,-6);



Rasheed Momoh wrote:

thanks but the formula is showing lines of syntax error, can u pls rectify them?

--- On Tue, 1/1/08, areehoi <areehoi@xxxxxxcom> wrote:
From: areehoi <areehoi@xxxxxxcom>
Subject: [amibroker] Re: YEARLY STOCK PERFORMANCE
To: amibroker@xxxxxxxxxps.com
Date: Tuesday, January 1, 2008, 8:48 AM

Try this "Performance Exploration" over your database of stocks. Sort
buy column 250 for top gainers or losers. Big gainers were "FSLR,SWIM,
ASTI etc.

Dick H.

basis = C;
perf1 = basis / Ref(basis, -1) * 100 - 100;
perf5 = basis / Ref(basis, -5) * 100 - 100;
perf30 = basis / Ref(basis, -30) * 100 - 100;
perf250 = basis / Ref(basis, -250) * 100 - 100;
//AddTextColumn( FullName(), "FullName" );
//AddTextColumn( IndustryID( 1) ," Industry Sector ", 25.0,
colorWhite, colorBlue);
//AddColumn( counter, "counter",1. 2,colorBrown) ;
//AddTextColumn( MarketID( 2) ," Market ", 25.0, colorWhite,
colorBlue);

//return = ROC(C,250);
AddColumn (Close, "Close",1.2) ;
AddColumn (Ref(Close,- 1), "Close-1",1. 2);
//AddColumn( RS, "RS", 1.3 ,IIf( RS >= 1, colorDarkGreen, colorRed ));
AddColumn(perf1, "perf1%", 1.2);
AddColumn(perf5, "perf5%", 1.2);
AddColumn(perf30, "perf30%", 1.2);
AddColumn(perf250, "perf250%", 1.2);
//AddColumn( return, "250 Bar Return", 1.2);
AddColumn(Volume, "Volume", 1.0);
AddColumn(MA( V,10),"MA( V10",1.0) ;
//AddColumn( (adr/C)*100, "ADR % of C", 2.2, colorDarkGreen, colorGold);
//AddColumn( ADR, "Avg Daily Range (10)", 2.2, colorWhite,colorBlu e);

Filter = 1; // dummy
//Filter = (1 != (IndustryID( 0)==x OR IndustryID(0) ==y OR
IndustryID(0) ==z));
//This will skip all stocks in Industry X,Y,Z (Assignments at
yourdiscretion) .

--- In amibroker@xxxxxxxxx ps.com, "rashmo_70" <rashmo_70@x ..> wrote:
>
> Hi guys is there a code to check yearly performance of Stocks in
database.
> Its similar to (quick market review) but i need to export as csv file
> thanks
>



Never miss a thing. Make Yahoo your homepage.
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

PNG image