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)
|
Bulli, try this indicator code:
[code:1:f0a2ee6de3]
===================
Date at Peak/Trough
===================
---8<-----------------------
{ Date at Peak/Trough }
{ ©Copyright 2005 Jose Silva
For personal use only.
http://www.metastocktools.com }
{ User inputs }
zzper:=Input("Peak/Trough reversal %",
.001,100,5);
format:=Input("Date format: [1]0.yymmdd, [2]ymmdd, [3]ddmmyy",1,3,1);
{ Event samples - Peaks & Troughs }
event1:=PeakBars(1,C,zzper)=0;
event2:=TroughBars(1,C,zzper)=0;
{ Event1's Day/Month/Year }
d:=ValueWhen(1,event1,DayOfMonth());
m:=ValueWhen(1,event1,Month());
y:=If(Year()<2000,Year()-1900,Year()-2000);
y:=ValueWhen(1,event1,y);
{ Event1 date in selected format }
yymmdd:=y*10000+m*100+d;
ptyymmdd:=yymmdd/1000000;
ddmmyy:=y+m*100+d*10000;
date:=If(format=1,ptyymmdd,
If(format=2,yymmdd,ddmmyy));
event1:=date*event1;
{ Event2's Day/Month/Year }
d:=ValueWhen(1,event2,DayOfMonth());
m:=ValueWhen(1,event2,Month());
y:=If(Year()<2000,Year()-1900,Year()-2000);
y:=ValueWhen(1,event2,y);
{ Event2 date in selected format }
yymmdd:=y*10000+m*100+d;
ptyymmdd:=yymmdd/1000000;
ddmmyy:=y+m*100+d*10000;
date:=If(format=1,ptyymmdd,
If(format=2,yymmdd,ddmmyy));
event2:=date*event2;
{ Plot signals in own window }
event1-event2
---8<-----------------------
[/code:1:f0a2ee6de3]
jose '-)
http://www.metastocktools.com
.
|