PureBytes Links
Trading Reference Links
|
Hi Pumrysh,
Foll. indicator's yr end signal not plotting correctly. For some yrs
it plots correctly on the last day of the yr (31'Mar) but for some
yrs it plots on the first day (1'Apr). In such a case, it would
include the Hi/Lo (if the Hi/Lo occurs on the 1st day) of the
following yr in the previous yr. Go back 6/7 yrs and you will
understand what I mean. Just check the variables "en" and "end". I've
plotted start as +1 and end as -1.
--------------------------------X----------------------------------
{HiLo of fin yr}
yr:=Input("Lookback years (0~CuFinYr, 1~PrFinYr)",0,100,0);
plot:=Input("1:HiLo 2:HiLoSignals 3:YrStart/End",1,3,3);
{ Current fin yr }
sd:=1;
sm:=4;
sy:=LastValue(Year())-yr;
{ Pr. fin yr }
sypr:=LastValue(Year())-(yr+1);
{ Fin yr start - current }
st1:=Year()>sy
OR (Year()=sy AND (Month()>sm
OR Month()=sm AND DayOfMonth()>=sd));
{ Fin yr start - previous }
st2:=Year()>sypr
OR (Year()=sypr AND (Month()>sm
OR Month()=sm AND DayOfMonth()>=sd));
{ Fin yr end }
ed:=31;
em:=3;
ey:=LastValue(Year())-yr;
en:=Year()<ey
OR (Year()=ey AND (Month()<em
OR Month()=em AND DayOfMonth()<ed));
{ Fin year start/end signals }
start1:=st1 AND Alert(st1=0,2);
start2:=st2 AND Alert(st2=0,2);
end:=en=0 AND Alert(en,2);
{ Period }
period:=st2 AND en;
{ Fin year's Hi/Lo }
hi:=Highest(ValueWhen(1,period,H));
lo:=Lowest(ValueWhen(1,period,L));
{ Hi/Lo signals }
hisignal:=If(H=LastValue(hi),1,0);
losignal:=If(L=LastValue(lo),1,0);
If(plot=1,hi,If(plot=2,hisignal,start2));
If(plot=1,lo,If(plot=2,-losignal,start2));
If(plot=1,lo,If(plot=2,-losignal,-end))
--------------------------------X----------------------------------
Regards
Arun
------------------------------------
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/
|