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

Re: [EquisMetaStock Group] Re: Need help with 52 week Hi/Lo values



PureBytes Links

Trading Reference Links

Preston

Thanks for the wonderful explanation. It was really helpful.

Can you please provide the link to the code you have mentioned in the email?

Also, what is the best way to test some code snippet like this (The only way I can think of is to create a temporary indicator and see the output in MS by adding line by line.. rather crude)

Appreciate your help very much..

regards

N

----- Original Message ----
From: pumrysh <no_reply@xxxxxxxxxxxxxxx>
To: equismetastock@xxxxxxxxxxxxxxx
Sent: Wednesday, March 26, 2008 12:04:00 PM
Subject: [EquisMetaStock Group] Re: Need help with 52 week Hi/Lo values

                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:=LastValu e(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@ yahoogroups. com, "nand_rathi" <nand_rathi@ ...> 
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
>


    
          			
<!--

#ygrp-mkp{
border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
#ygrp-mkp #ads{
margin-bottom:10px;}
#ygrp-mkp .ad{
padding:0 0;}
#ygrp-mkp .ad a{
color:#0000ff;text-decoration:none;}
-->

<!--

#ygrp-sponsor #ygrp-lc{
font-family:Arial;}
#ygrp-sponsor #ygrp-lc #hd{
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
#ygrp-sponsor #ygrp-lc .ad{
margin-bottom:10px;padding:0 0;}
-->
	
<!--

	#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
#ygrp-vitnav a{
padding:0 1px;}
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;font-size:77%;padding:15px 0;}
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;}

#ygrp-reco {
margin-bottom:20px;padding:0px;}
#ygrp-reco #reco-head {
font-weight:bold;color:#ff7900;}

#reco-grpname{
font-weight:bold;margin-top:10px;}
#reco-category{
font-size:77%;}
#reco-desc{
font-size:77%;}

#ygrp-vital{
background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{
padding:0;margin:2px 0;}
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

#ygrp-sponsor #hd{
color:#999;font-size:77%;}
#ygrp-sponsor #ov{
padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;margin:0;}
#ygrp-sponsor #ov li{
list-style-type:square;padding:6px 0;font-size:77%;}
#ygrp-sponsor #ov li a{
text-decoration:none;font-size:130%;}
#ygrp-sponsor #nc{
background-color:#eee;margin-bottom:20px;padding:0 8px;}
#ygrp-sponsor .ad{
padding:8px 0;}
#ygrp-sponsor .ad #hd1{
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
#ygrp-sponsor .ad a{
text-decoration:none;}
#ygrp-sponsor .ad a:hover{
text-decoration:underline;}
#ygrp-sponsor .ad p{
margin:0;}
o{font-size:0;}
.MsoNormal{
margin:0 0 0 0;}
#ygrp-text tt{
font-size:120%;}
blockquote{margin:0 0 0 4px;}
.replbq{margin:4;}
-->
		





      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

[Non-text portions of this message have been removed]


------------------------------------

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/