Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
...Or try this indicator:
[code:1:7465deb2a6]
MetaStock -> Tools -> Indicator Builder -> New
-> Copy and paste formula below.
======================
52-week true High/Lows
======================
---8<-------------------------------
{ True 52-week Highs & Lows, signals - v2.0 }
{ ©Copyright 2004~2005 Jose Silva.
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 }
{ User input }
yr:=Input("Lookback Nr of years",1,100,1);
plot:=Input("Year's Hi/Lo: [1]Values, [2]Signals, [3]Start",1,3,1);
{ Last available day/month/year }
ToDay:=LastValue(DayOfMonth());
ToMnth:=LastValue(Month());
lastYear:=LastValue(Year())-yr;
{ 52-week period }
52week:=Year()>lastYear
OR (Year()=lastYear AND (Month()>ToMnth
OR Month()=ToMnth AND DayOfMonth()>=ToDay));
{ 52-week signal }
start:=52week AND Alert(52week=0,2);
{ 52-week Hi/Lo }
init:=Cum(1)=1;
hi:=If(52week,HighestSince(1,start OR init,H),
C);
lo:=If(52week,LowestSince(1,start OR init,L),C);
{ 52-week Hi/Lo signals }
hiSignals:=H>Ref(hi,-1) AND 52week AND start=0;
loSignals:=L<Ref(lo,-1) AND 52week AND start=0;
{ Plot in own window }
If(plot=1,hi,If(plot=2,hiSignals,0));
If(plot=1,lo,If(plot=2,-loSignals,start))
---8<-------------------------------
[/code:1:7465deb2a6]
jose '-)
|
1 user thanked Jose for this useful post.
|
|