logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Bulli  
#1 Posted : Monday, September 26, 2005 8:11:07 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

How can I find the Date of the Peak bar using a formula? Thanks, Bulli
Jose  
#2 Posted : Monday, September 26, 2005 11:36:46 PM(UTC)
Jose

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 .
kanellop  
#3 Posted : Monday, September 26, 2005 11:47:23 PM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Dear Jose, Can you give with Words more explain in your Formula? :roll: I put it in my Metastock, but i can not undestand how is working! oz_pdt_02i Also i want to please you in kind to answer me, if you are a Computer Programmer? :smt024 George K. :smt040
Jose  
#4 Posted : Monday, September 26, 2005 11:58:09 PM(UTC)
Jose

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)
Cantaloupe, each spike signals a peak(+) and a trough(-). The level of each spike returns a value (in MetaStock's Data Window), which corresponds to the date of the peak or trough. To find the date of the last peak or trough in an exploration: ColA: ---8<------------------ x:=Fml("Date at Peak/Trough"); ValueWhen(1,x<>0,x) ---8<------------------ Play around some with the indicator, and its operation will become clearer. jose '-) http://www.metastocktools.com .
Bulli  
#5 Posted : Tuesday, September 27, 2005 12:06:25 AM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Thank you very much. Thanks, Bulli
kanellop  
#6 Posted : Tuesday, September 27, 2005 12:12:58 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Dear Jose, I wll not make any comment to your Formula. It is a little difficult for me to understand it. I had create a Formula without Success. I want to found the DayofMonth, Month and Year when exist the following thing: Cross(Mov(c,15,e),mov(c,200,e)) wih the following Formula in Metastock: d:=ValueWhen(1,Cross(Mov(C,15,E),Mov(C,200,E)),DayOfMonth()); m:=ValueWhen(1,Cross(Mov(C,15,E),Mov(C,200,E)),Month()); y:=ValueWhen(1,Cross(Mov(C,15,E),Mov(C,200,E)),y);d*m*y I can not see any result. Do you have opinion how i can fix that problem? Also you didn't answer me if you are a Computer Programmer. :smt024 George K. :smt040
kanellop  
#7 Posted : Tuesday, September 27, 2005 12:27:26 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Dear Jose, I am thinking that i have found the Solution. Here it is: d:=ValueWhen(1,Cross(Mov(C,15,E),Mov(C,200,E)),DayOfMonth()); m:=ValueWhen(1,Cross(Mov(C,15,E),Mov(C,200,E)),Month()); y:=ValueWhen(1,Cross(Mov(C,15,E),Mov(C,200,E)),Year());y*10000+m*100+d What do you believe? George K. :smt040
Jose  
#8 Posted : Tuesday, September 27, 2005 12:45:02 AM(UTC)
Jose

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)
George, I believe you've got it - well done. :) And my programming skills are basic - I'm not a programmer by any stretch of the imagination. jose '-)
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.