Discussions
»
Product and Service Development
»
MetaStock
»
MS2005 - Smoothed Adaptive Stoch Osc irregularities
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.
|
|
|
|
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?
|
|
|
|
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 '-)
|
|
|
|
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]
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
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 '-)
|
|
|
|
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)
|
Discussions
»
Product and Service Development
»
MetaStock
»
MS2005 - Smoothed Adaptive Stoch Osc irregularities
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.