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

Notification

Icon
Error

Options
Go to last post Go to first unread
Mac  
#1 Posted : Friday, February 10, 2006 5:11:13 PM(UTC)
Mac

Rank: Member

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

My version of MetaStock Professional is 9.1, and my question concerns MetaStock's indicator, MS2005 - Smoothed Adaptive Stoch Osc. The formula of the slightly (cosmetically) modified version of the indicator that I use is as follows: n:=Input("Std Dev lookback period",1,50,8); x:=Input("%K smoothing ma",1,50,5); lenmax:=28; lenmin:=7; v1:=Stdev(C,n); v2:=HHV(v1,n); v3:=LLV(v1,n); v4:=((v1-v3)/(v2-v3)); currlen:=(Int(lenmin+(lenmax-lenmin)*(1-v4))); hh:=HHV(H,LastValue(currlen)); ll:=LLV(L,LastValue(currlen)); Check:=If((hh-ll)=0,0.0001,(hh-ll)); RawStochK:=((C-ll)/Check)*100; Mov(RawStochK,x,E)-50; 40; -40 What I find strange is that frequently (not always), when updating in RT, past screen elements of the data array of the MS2005 - Smoothed Adaptive Stochastic Oscillator collectively change instead of just the last period, as is the case with all other indicators in my template. The changes aren't drastic but disturbing when I would like to think that those elements occurring in the past are now set. I enjoy the forum and appreciate any explanations you might have.
Patrick  
#2 Posted : Friday, February 10, 2006 5:26:45 PM(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)
Your check is kinda weird ... What was the original code?
Jose  
#3 Posted : Friday, February 10, 2006 5:40:34 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)
The LastValue() function utilizes hindsight when plotting previous values. As the last bar's value changes, so do all previous bar's values. jose '-)
Mac  
#4 Posted : Friday, February 10, 2006 5:46:49 PM(UTC)
Mac

Rank: Member

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

Regarding Patrick's question about the original code of the MS2005 - Smoothed Adaptive Stochastic Oscillator. What I have is the following: [code:1:981a5aa2f0]n:=Input("Volatility lookback Period",1,50,8); x:=Input("%K smoothing",1,50,5); y:=Input("%D smoothing",1,50,5); lenmax:=28; lenmin:=7; v1:=Stdev(C,n); v2:=HHV(v1,n); v3:=LLV(v1,n); v4:=((v1-v3)/(v2-v3)); currlen:=(Int(lenmin+(lenmax-lenmin)*(1-v4))); hh:=HHV(H,LastValue(currlen)); ll:=LLV(L,LastValue(currlen)); Check:=If((hh-ll)=0,0.0001,(hh-ll)); RawStochK:=((C-ll)/Check)*100; SmoothedStochK:=Mov(RawStochK,x,E); StochD:=Mov(SmoothedStochK,y,E); StochD;[/code:1:981a5aa2f0]
Mac  
#5 Posted : Friday, February 10, 2006 6:09:35 PM(UTC)
Mac

Rank: Member

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

What Jose says makes sense. I'm left, though, with the question of the reasoning of the MetaStock programmers. Was the lastvalue issue recognized as an acceptable way for the indicator to perform, or perhaps might the result have been overlooked? Maybe there is an update to the indicator. I like the indicator and its use of Stdev() and will probably retain it regardless, although not without something of a nagging doubt. And thanks Jose for your response.
Patrick  
#6 Posted : Friday, February 10, 2006 6:16:25 PM(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)
Being the person who wrote this I can tell you that I most likely intended to write it this way: [code:1:9b20ee6871]n:=Input("Volatility lookback Period",1,50,8); x:=Input("%K smoothing",1,50,5); y:=Input("%D smoothing",1,50,5); lenmax:=28; lenmin:=7; v1:=Stdev(C,n); v2:=HHV(v1,n); v3:=LLV(v1,n); v4:=((v1-v3)/(v2-v3)); currlen:=(Int(lenmin+(lenmax-lenmin)*(1-v4))); hh:=HHV(H,LastValue(currlen+prev-prev)); ll:=LLV(L,LastValue(currlen+prev-prev)); Check:=If((hh-ll)=0,0.0001,(hh-ll)); RawStochK:=((C-ll)/Check)*100; SmoothedStochK:=Mov(RawStochK,x,E); StochD:=Mov(SmoothedStochK,y,E); StochD;[/code:1:9b20ee6871] Though it's been so long that I don't really know for sure what I was thinking :P
Jose  
#7 Posted : Friday, February 10, 2006 6:31:31 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)
This post may be of some interest here. jose '-)
Mac  
#8 Posted : Friday, February 10, 2006 6:31:48 PM(UTC)
Mac

Rank: Member

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

Thank you Patrick! You have relieved my "nagging doubt."
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.