Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 8/11/2005(UTC) Posts: 104
|
Hi,
I would like to plot vertical Lines at Fibonacci Calendar day intervals
on a chart. ( say 144,233,377,610,987,1597 Calendar days )
see formula below (with thanks to Jose Silva
But I must be using the MetaStock Alert function incorrectly
“ Alert(Expression, Periods) “
When a Fibonacci time signal falls on a weekend I get no plot
Hoping you can help;
Kind regards,
Derek
Code:
----------80
OR Frac(limit/400)=0;
NoCount:=limit*365+Int(limit/4)
-Int(limit/100)+Int(limit/400)-LimLeap;
leap:=Frac(Year()/4)=0 AND Frac(Year()/100)0
OR Frac(Year()/400)=0;
y:=Year()*365+Int(Year()/4)
-Int(Year()/100)+Int(Year()/400)-NoCount;
m:=
If(Month()=2,31-leap,
If(Month()=3,59,
If(Month()=4,90,
If(Month()=5,120,
If(Month()=6,151,
If(Month()=7,181,
If(Month()=8,212,
If(Month()=9,243,
If(Month()=10,273,
If(Month()=11,304,
If(Month()=12,334,
-leap)))))))))));
DayNr:=y+m+DayOfMonth();
{ Restrict Nth to max events }
nth:=
LastValue(If(nth>Cum(event),Cum(event),nth));
{ Days since Nth event }
DaysSince:=(DayNr-ValueWhen(nth,event,DayNr));
{ Plot in own window }
If(plot=1,DaysSince,If(plot=2,event,DayNr));
Fib:=If(DaysSince=0 OR DaysSince=144 OR DaysSince=233 OR DaysSince=377 OR DaysSince=610 OR DaysSince=987 OR DaysSince=1597,100,0);
Fib AND Alert(Fib,2);
----------8<------------------------------------------------
|