log in     sign up for free
 
My percentage of winners is only about 50/50, because I cut my losers very quickly. The maximum loss I allow is 7 percent, and usually I am out of a losing stock a lot quicker. I make my money on the few stocks a year that double and triple in price.
David Ryan
 
 
Home
systems (284)
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Stochastic Oscillator Monthly EMA

Formula for: MetaStock

indicator


 

 

Views:  1246

Added: January 06, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 

email this link

 
 
Tags: MetaStock, indicator
 
Your Ad Here
Hi,
I would like to plot a monthly stochastic on a weekly chart ?

Here is the code of the stochastic I use :

Mov(Stoch(14,1),5,E)

Thanks in advance for your valuable help,
Regards,

Marco

======================================

Hi Marco

Here's a monthly stochastic for daily charts. You can also use it for weekly charts, but remember that the end-of-month date is different for daily and monthly charts than it is for weekly charts. This is because the end of a month does not necessarily coincide with the end of a week. For example, on a weekly chart May 2005 finished on the 27th, but on daily and monthly charts it finished on the 31st.

Kind regards

Roy Larsen
www.metastocktips.co.nz



Stochastic Oscillator Monthly EMA

{2005 Roy Larsen, www.metastocktips.co.nz}
{for use on daily charts}

N:=Input("Monthly Stochastic Oscillator Periods (%K)",1,99,14);
K:=Input("%K Slowing Periods" ,1,99,1);
D:=Input("%D EMA Periods",1,99,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,1);
{0=Display, update at end-of-month}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new month}
G:=LastValue(Sum(Month()<>ValueWhen(2,1,Month()),5)=5);
M:=G OR Month()<>ValueWhen(2,1,Month());
F:=G OR PeakBars(1,Zig(If(G*(Cum(1)=1),1,DayOfMonth()),1,$),1)=0;
A:=LastValue(Cum(1)-1)=Cum(1);
B:=ValueWhen(2,1,A);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Hm:=HighestSince(1,M,H);
Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm)));
Lm:=LowestSince(1,M,L);
Lm:=ValueWhen(1,J,If(J=1,Lm,ValueWhen(2-G,1,Lm)));
Cm:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Hm:=ValueWhen(1,Hm>0,Hm);
Lm:=ValueWhen(1,Lm>0,Lm);
Z:=Cum(LowestSince(N,M,Lm)*(J>0));
Z:=Cm-(Z-ValueWhen(K+1,J,Z));
I:=Cum((HighestSince(N,J,Hm)-LowestSince(N,J,Lm))*(J>0));
I:=I-ValueWhen(K+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*Z/I; A:=2/(1+D);
X:=ValueWhen(1,Cum(J>0)>=K+N,X);
Y:=ValueWhen(1,J,PREV)*(1-A)+X*A;
Y:=ValueWhen(1,Cum(J>0)>=N+K+D,Y);
X; {%K}
Y; {%D}






======================================

Hi Roy,

It works fine :)

Thank you very much

Regards,
Marco

 

 



Code:

Stochastic Oscillator Monthly EMA

{2005 Roy Larsen, www.metastocktips.co.nz}
{for use on daily charts}

N:=Input("Monthly Stochastic Oscillator Periods (%K)",1,99,14);
K:=Input("%K Slowing Periods" ,1,99,1);
D:=Input("%D EMA Periods",1,99,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,1);
{0=Display, update at end-of-month}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new month}
G:=LastValue(Sum(Month()<>ValueWhen(2,1,Month()),5)=5);
M:=G OR Month()<>ValueWhen(2,1,Month());
F:=G OR PeakBars(1,Zig(If(G*(Cum(1)=1),1,DayOfMonth()),1,$),1)=0;
A:=LastValue(Cum(1)-1)=Cum(1);
B:=ValueWhen(2,1,A);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Hm:=HighestSince(1,M,H);
Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm)));
Lm:=LowestSince(1,M,L);
Lm:=ValueWhen(1,J,If(J=1,Lm,ValueWhen(2-G,1,Lm)));
Cm:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Hm:=ValueWhen(1,Hm>0,Hm);
Lm:=ValueWhen(1,Lm>0,Lm);
Z:=Cum(LowestSince(N,M,Lm)*(J>0));
Z:=Cm-(Z-ValueWhen(K+1,J,Z));
I:=Cum((HighestSince(N,J,Hm)-LowestSince(N,J,Lm))*(J>0));
I:=I-ValueWhen(K+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*Z/I; A:=2/(1+D);
X:=ValueWhen(1,Cum(J>0)>=K+N,X);
Y:=ValueWhen(1,J,PREV)*(1-A)+X*A;
Y:=ValueWhen(1,Cum(J>0)>=N+K+D,Y);
X; {%K}
Y; {%D}

 






Author: Roy Larsen
Source: EquisMetastock[at]yahoogroups[dot]com

 

View similar (indicator for MetaStock):

Directional Trend Index
Trend Detection Index
Chande's Vidya Using P Variable - Version I
Displace Indicator Forward
GAP Trading
Stochastic PVT Indicator
Ken Roberts' Formulas
Volatility - Annualized
Accumulation/ Distribution
Better Bollinger Bands
...
 
 
all formulas for MetaStock
all formulas

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
 
Privacy note | (c) copyrights systems4trading.com 2006-2012