PureBytes Links
Trading Reference Links
|
N,
Please realize that I did not write the code. It was written by
Wabbit aka Scott Bunny on the Equis Forum. I believe he is a member
here as well and maybe he will pipe in on the discussion.
I have listed the indicator below and have included referencing line
numbers to make an explanation easier.
{52 week HIGH & LOW}
{From Wabbit at Equis Forum}
{1} lastDay:=LastValue(DayOfMonth());
{2} lastMonth:=LastValue(Month());
{3} lastYear:=LastValue(Year())-1;
{4} x:=Year()>lastYear OR (Year()=lastYear AND
(Month()>lastMonth OR Month()=lastMonth AND
DayOfMonth()>=lastDay));
{5} y:=x AND Alert(x=0,2);
{6} i:=Cum(1)=1;
{7} hi:=LastValue((HighestSince(1,y OR i,H)))*(BarsSince(x>0)>= -1);
{8} lo:=LastValue((LowestSince(1,y OR i,L)))*(BarsSince(x>0)>= -1);
{plot}
hi;lo;
{end}
Lines 1,2,3 obtains the value of the present date by day, month and
year.
Line 4 establishes the 52 week window of time.
Line 5 establishes the start of the calculation period by using the
beginning of calculation period and the alert function together to
give us a value of one on the first day of the 52 week window.
Line 6 resets the bar count. I really don't feel this is necessary
nor is it (OR i) necessary in the highestsince / lowestsince argument
in lines 7 and 8.
Line 7 and 8 calculates the highest high and lowest low for the 52
week period and holds or plots it true for the 52 weeks.
One of the problems that I think you are going to run into using this
code in an exploration is the fact that new lows or highs during the
52 week period will reset the indicator. Remember the 52 week period
resets every day.
I also provided other code in my original code and that might be a
better option for you.
Thanks for the question. Hope you will find my reply helpful.
Preston
--- In equismetastock@xxxxxxxxxxxxxxx, "nand_rathi" <nand_rathi@xxx>
wrote:
>
> This post is for Preston in particular.
>
> Hello Preston
>
> Around a week back you provided MS code to determine 52 week Hi/LO
for
> a stock. I am a newbie in Metastock arena and trying to understand
the
> power of this tool.
>
> I have the following questions regarding the code provided by you:
>
> Would you be kind to explain the code line by line so that for a
> newbie it will make sense in how to interpret such code snippet?
>
> I created a formula with the supplied code and it worked great in
> plotting the Hi/Lo value. How do I use this code in explorer? What I
> want to do is to display the list of stock which are say within 2.5%
> range oh Hi or Lo?
>
> I am sorry if this type of question has already been answered in the
> group. I am sure this explanation will be of great help to
newbies..
>
> Regards
>
> N
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|