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

Notification

Icon
Error

Options
Go to last post Go to first unread
Jose  
#1 Posted : Thursday, November 3, 2005 1:24:38 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)
Ever wanted to measure the Rate of Change (RoC/Momentum in MetaStock) since a defined past event, rather than since the normal x periods ago? The indicators below will measure % or $ RoC since the beginning of year as default. Input your own event code (or system entry signals code) to measure RoC since a specific date or event. [code:1:d2724f829c] MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formulae between "---8<---" lines. =============== RoC since event =============== ---8<-------------------------- { Rate of Change (RoC) since past event v1.0 } { ©Copyright 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 inputs } choose:=Input("event: [1]Week, [2]Month, [3]Year, [4]User-defined",1,5,3); method:=Input("method: [1]%-percent, [2]$-points",1,2,1); plot:=Input("plot: [1]RoC, [2]Event signals", 1,2,1); { Event1 - start of Week } event1:=DayOfWeek()<Ref(DayOfWeek(),-1); { Event2 - start of Month } event2:=DayOfMonth()<Ref(DayOfMonth(),-1); { Event3 - start of Year } event3:=Year()<>Ref(Year(),-1); { Event4 - EMA crossover signals example } event4:=Cross(Mov(C,5,E),Mov(C,21,E)); { Event5 - LinReg crossover signals example } event5:=Cross(LinearReg(C,5),LinearReg(C,21)); { Choose event } event:= If(choose=1,event1, If(choose=2,event2, If(choose=3,event3, If(choose=4,event4, event5)))); { Event's Close value } start:=Cum(IsDefined(event))=1; eventVal:=ValueWhen(1,event OR start,C); { RoC since chosen event } RoCper:=(C/eventVal-1)*100; RoCpts:=C-eventVal; { Select % or $ method } eventRoC:=If(method=1,RoCper,RoCpts); { Plot in own window } If(plot=1,eventRoC,event) ---8<-------------------------- [/code:1:d2724f829c] jose '-)
Jose  
#2 Posted : Thursday, November 3, 2005 1:27:21 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)
[code:1:92e988bdf6] ============== RoC since date ============== ---8<-------------------------- { Rate of Change (RoC) since past date v1.0 } { ©Copyright 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 inputs } StDay:=Input("Day",1,31,1); StMnth:=Input("Month",1,12,1); StYear:=Input("Year",1800,2200,2005); method:=Input("method: [1]%-percent, [2]$-points",1,2,1); plot:=Input("plot: [1]RoC, [2]Date signal", 1,2,1); { Event date's signal } date:=Year()>StYear OR (Year()=StYear AND (Month()>StMnth OR Month()=StMnth AND DayOfMonth()>=StDay)); event:=date AND Alert(date=0,2); { Event's Close value } start:=Cum(IsDefined(event))=1; eventVal:=ValueWhen(1,event OR start,C); { RoC since chosen event } RoCper:=(C/eventVal-1)*100; RoCpts:=C-eventVal; { Select % or $ method } eventRoC:=If(method=1,RoCper,RoCpts); eventRoC:=If(date,eventRoC,0); { Plot in own window } If(plot=1,eventRoC,event) ---8<-------------------------- [/code:1:92e988bdf6] jose '-)
investorretired  
#3 Posted : Thursday, November 3, 2005 4:46:06 PM(UTC)
investorretired

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/13/2005(UTC)
Posts: 52

I have a mall problem with the “RoC since date” indicator. When the date is changed buy using the up/down arrow it inserts a “,” in the number. That prompts an error message. ??????
mstt  
#4 Posted : Thursday, November 3, 2005 9:38:45 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Investorretired That's not a problem with the indicator or MetaStock, it's related to a Windows setting for the computer, specifically the use of a comma every third significant number I think. I forget what the exact setting is, but when I investigated it I found that the cure was worse than the ailment. the quickest way around the "problem" is to highlight the number(s) you want to change in the indicator Parameter window, and type in the new number. A number of other "fixes" spring to mind, but none of them will work if you believe the problem is with Jose's indicator. Roy MetaStock Tips & Tools
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.