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

Notification

Icon
Error

Options
Go to last post Go to first unread
kwadrat  
#1 Posted : Monday, June 13, 2005 8:17:05 PM(UTC)
kwadrat

Rank: Newbie

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

hi could anyone help me please. i have the following problem: in the ref() formula one must use only constant data i.e. ref([censored],-1) or ref([censored], lastvalue(aaa) ) what should i do when i want to use different values for every bar i.e. a:=calculated value for each bar; ref([censored],-a) i cannot use ref([censored],lastvalue(a) ) beacause then only the last value is inserted into the ref() formula, but i need different values for every bar . i.e i want to calculate : (present value of the indicator) - (value of the indicator "a" periods ago) and "a" is different for every bar (it is calculated exclusively for each bar) thank you for your help
Patrick  
#2 Posted : Saturday, June 18, 2005 3:27:25 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Sorry this is more than difficult ... I don't think it is possible ... Patrick :mrgreen:
wabbit  
#3 Posted : Saturday, June 18, 2005 3:36:47 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
I think this topic has already been discussed on the forum.... have a look at the capabilities of the valuewhen() function and see if that can solve your problem... otherwise post yuor code and we will see if there is a better/alternate way to achieve your aim wabbit :D
StorkBite  
#4 Posted : Saturday, June 18, 2005 9:46:55 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hey K- I reanamed your post to something more discriptive than the generic 'I NEED HELP WITH A TOUGH QUESTION' header. You might actually get more people to look at your question this way. :)
wabbit  
#5 Posted : Sunday, June 19, 2005 10:01:39 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
kwadrat, Have you tried fitting, LastValue(Ind+PREV-PREV) into the solution? wabbit :D P.S. kwadrat, please post your code and we shall see if we can get this question sorted out once and for all. This could be a really interesting problem, but at the moment it is just a cryptic crossword with no clues! P.P.S. For any others reading this post, does the +PREV-PREV confuse you? Does this exceptionally powerful function need more explanation? Let us know.
henry1224  
#6 Posted : Monday, June 20, 2005 12:15:22 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
This is the hard code for a variable moving average {Vidya (Chande)} Pds:= Input("Number of Periods?",1,1000,20); Alpha:= 2/(Pds+1); {Chande Momentum Oscillator} {UD = Up day} {DD = Down day} UD:= Sum((C-Ref(C,-1))*(C>Ref(C,-1)),9); DD:= Sum((Ref(C,-1)-C)*(C<Ref(C,-1)),9); CMOsc:= (UD-DD)/(UD+DD); k:= Abs(CMOsc); Vidya:= (Cum(1) < Pds) * C + (Cum(1)>=Pds) * ((Alpha * k * C) + (1-Alpha* k) * PREV); Vidya It plots just like Pds:= Input("Number of Periods?",1,1000,20); Mov(C,Pds,Var); now the variable moving average adjusts from the volatility I don't know if this will help in your search, but here's a way to adjust an indicator
bradulrich  
#7 Posted : Thursday, June 30, 2005 3:25:24 AM(UTC)
bradulrich

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/5/2005(UTC)
Posts: 35

What you have asked for, which most people call and ADAPTIVE Ref() function, is not offered in Metastock. Just to clarify, this means that the number of periods input for the indicator can be a DATA ARRAY. The Metastock version requires that the input be a CONSTANT. Allowing a DATA ARRAY as input (technically a time-series function) allows you to change the number of lookback periods from bar-to-bar. Another subtle use of an indicator like this would be to supply a VARIABLE as input (and don't go looking 'cause this is not a real data type in Metastock), even if the input did not change from bar-to-bar. For example, the use of "sin(10)" as input to the ref() function is illegal, because it is not a CONSTANT, but it is also not a DATA ARRAY that changes from bar-to-bar. But getting back on track...there are MANY, MANY uses for adaptive indicators in general, not just the ref() function, and not just for use as an end indicator. For example, an adaptive Mov() function is a useful end indicator, where as an adaptive Ref() function can be thought of instead, as a VERY useful tool that can extend the power of the Metastock formula language. Therefore, over the years there have been workaround to acheive a true adaptive indicator, but all of them fall short in some way or another. The lastvalue() function is a complete no-no, as it results in "retroactively" calculating previous bar's values for the result, which, of course, violates the rule that an indicator can not "look into the future"... The (lastvalue()+PREV-PREV) function is also not a good idea. It has never been condoned by Equis, and it has the following drawbacks: 1.) it is very slow. it can only be used once or twice (not in a single indicator, but over the entire set of indicators you have loaded). Any more than this, and it completely bogs down the processor. 2.) It gives INCORRECT results. It just plain gives the wrong answer sometimes. This is obviously a problem.
Now the kicker - A new company called the Dynamic Market Lab offers 33 adaptive indicators for Metastock. The advantages of the company, its services, and its products go far beyond what is relevant to this particular post...so please visit our website for an introduction - www.thedml.com. Thanks, Brad Ulrich Developer The Dynamic Market Lab, LLC www.thedml.com
wabbit  
#8 Posted : Thursday, June 30, 2005 8:58:26 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
whats the name of that Monty Python song?
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.