PureBytes Links
Trading Reference Links
|
There are a few things wrong with your calculations.
CV is a logic statement and will be 0 or 1, true or false.
CV5 gives the value of C 5 bars ago.
To get the % difference you need to use the formula below and note
the () around the C - CV5. If you don't do this the math is C -
CV5/CV5 which equals C - 1.
pctdiff = iif(CV, (C - CV5) / CV5 * 100, 0);
then
AddColumn(pctdiff,"% Dif", 3.2, colorYellow,colorGreen);
or you could put the formula in the AddColumn.
I changed the formula to this
Low52week = LLV(C,252); // 52 week low
CV = IIf(C <= Low52week, Low52week, 0); // if 52 week low return the
low value
CV5 = Ref(Close,-5); // return C 5 bars ago
pctdiff = (C - CV5) / CV5 * 100; // calculate the
Filter = CV; // if CV is not zero
AddTextColumn( FullName(), "FullName" );
AddTextColumn(IndustryID(1) ," Industry Sector ", 25.0,
colorWhite, colorBlue);
AddColumn(CV,"52 weekLow",1.2,colorBrown);
AddColumn(CV5,"C 5 days ago",1.2,colorOrange);
AddColumn(C,"Close");
AddColumn(pctdiff,"% Dif", 3.2, colorYellow,colorGreen);
When I ran this, today's low was the 52 week low for every stock.
That is hard to believe but I can't see and error in the formula.
Hope that helps,
Barry
--- In amibroker@xxxxxxxxxxxxxxx, "areehoi" <areehoi@xxx> wrote:
>
> I'm trying to implement an Exploration that will find those stocks
> reaching a 52 week lows and at the same time show the difference
from
> 5 days ago (or any other period one may decide upon). When I run
the
> Exploration I get the 52 week lows Okay but the % difference for the
> 5days show up as "-99.00 for all? And, under the 52 week column it
> doesn't show the close price. Any help will be appreciated.
Thanks
>
> Dick H
>
> //Stocks at 52 WeekLows Bounce-back last 5 days
>
> CV = (C <= LLV(C,252));
> CV5 =(Ref(Close,-5));
> Filter = CV;
> AddTextColumn( FullName(), "FullName" );
> AddTextColumn(IndustryID(1) ," Industry Sector ", 25.0,
> colorWhite, colorBlue);
> AddColumn(CV,"52 weekLow",1.2,colorBrown);
> AddColumn(CV5,"52 WkLo-5",1.2,colorOrange);
> AddColumn(C,"Close");
> AddColumn(CV-CV5/CV5*100,"% Dif", 3.2, colorYellow,colorGreen);
>
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|