MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

High/Low of Date Period by Jose Silva

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: murusprimus <sace[at]shaw.ca>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Sunday, October 8, 2006, 9:12:26 AM
Subject: [EquisMetaStock Group] Code Help

Following code uses the H-L of the chart

can you provide the code that would use the H-L of a specified
yyyymmdd date
or
H-L of past 1-10000 days

Wallace

j:=Input("year to begin line study",1800,3000,2006);
k:=Input("month to begin line study",1,12,1);
m:=Input("day of month to begin line study",1,31,4);
ext:=Input("Extension: 1=upward; 2=downward; 0=none",0,2,0);
hi:=Input("high",0,20000,100);
lo:=Input("low",0,20000,50);
BeginPlot:=Year()=j AND Month()=k AND DayOfMonth()=m;
n:=ValueWhen(1,BeginPlot,(hi-(hi-lo)*2.618));
q:=ValueWhen(1,BeginPlot,(hi-(hi-lo)*1.618));
u:=ValueWhen(1,BeginPlot,(hi-(hi-lo)*1.382));
x:=ValueWhen(1,BeginPlot,((hi-lo)*1.382)+lo);
y:=ValueWhen(1,BeginPlot,((hi-lo)*1.618)+lo);
z:=ValueWhen(1,BeginPlot,((hi-lo)*2.618)+lo);
If(ext=1,n,lo);
If(ext=1,q,lo);
If(ext=1,u,lo);
ValueWhen(1,BeginPlot,lo);
ValueWhen(1,BeginPlot,((hi-lo)*.236)+lo);
ValueWhen(1,BeginPlot,((hi-lo)*.382)+lo);
ValueWhen(1,BeginPlot,((hi-lo)*.5)+lo);
ValueWhen(1,BeginPlot,((hi-lo)*.618)+lo);
ValueWhen(1,BeginPlot,((hi-lo)*.764)+lo);
ValueWhen(1,BeginPlot,((hi-lo)*1.464)+lo);
ValueWhen(1,BeginPlot,hi);
If(ext=2,x,hi);
If(ext=2,y,hi);
If(ext=2,z,hi);

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Sunday, October 8, 2006, 1:52:35 PM
Subject: [EquisMetaStock Group] Re: Code Help

Wallace, I'm not sure if this is what you want, but perhaps you can adapt it to your requirements if not.

MetaStock -> Tools -> Indicator Builder -> New -> copy & paste complete formula.

High/Low of Date Period

{Plots High/Low of user-input date period.

The grant of this license is for personal use
only - no resale or repackaging allowed.
All code remains the property of Jose Silva.
http://www.metastocktools.com }

{ Date inputs }
StDay:=Input("start Day",1,31,1);
StMnth:=Input("start Month",1,12,1);
StYear:=Input("start Year",1800,2200,2006);
EnDay:=Input("end Day",1,31,1);
EnMnth:=Input("end Month",1,12,7);
EnYear:=Input("end Year",1800,2200,2006);

{ Restrict plot to selected period }
start:=Year()>StYear
OR (Year()=StYear AND (Month()>StMnth
OR Month()=StMnth AND DayOfMonth()>=StDay));
end:=Year()<EnYear
OR (Year()=EnYear AND (Month()<EnMnth
OR Month()=EnMnth AND DayOfMonth()<=EnDay));

{ High/Low for selected period }
period:=start AND end;
Hi:=Highest(ValueWhen(1,period,H));
Lo:=Lowest(ValueWhen(1,period,L));

{ Enable below to restrict plot to period }
Hi:=Ref(Ref(Hi,-plot),plot);
Lo:=Ref(Ref(Lo,-plot),plot);}

{ Plot on price chart }
Hi;Lo

Source / From: TOP
Metastockusers[at]yahoogroups[dot]com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.