PureBytes Links
Trading Reference Links
|
jaguar
> What I am tring to do is to add a number of different timeframes of
> the Stochastic to one chart. If I have a 14,3 on a 10 minute chart
> and want to show this indicator from a 20 minute chart on the 10
> minute chart do I double the 14,3?
This "Frame Stochastic Osc SMA" is based on my weekly Stoch Osc for daily charts and will do what
you say you want much more accurately than merely changing the numbers. Changing the numbers just
changes the oscillator values for the existing timeframe. It has little relationship to the
oscillator values for a longer (or shorter) timeframe.
Getting the oscillator to work as intended requires one primary variable 'M' to be defined by you.
This is the first bar of the required timeframe - for use on daily charts as a weekly oscillator
this would be Monday, or the first trading day of the week.
It's also necessary (if you want to use other than the "test" mode) to define the last bar of the
frame, 'F' variable, if and when it is present. For daily/weekly usage this would be the Friday bar.
This enables the indicator to update as this bar is formed. In test mode each frame will be updated
when the first bar of the next frame is created.
The 'G' variable is there to signal when the chart periodicy is already set to the longer time frame
and therefore there is no need to group bars into separate frames to form a new data array (the
indicator is to operate in the same timeframe as the chart).
I have only made a crude attempt to set 'M', and no attempt at all to set 'F' and 'G' to your
requirements. 'G' is presently set to differentiate between intraday and daily charts.
This indicator has an SMA signal line. A slightly different version is required for an EMA signal
line.
Roy
{Frame Stochastic Osc SMA}
{Copyright© 2003-2004 Roy Larsen}
{rlarsen@xxxxxxxxxxxxxx}
{for use on intraday charts}
K:=Input("%K Periods",1,99,5);
N:=Input("%K Slowing Periods" ,1,99,3);
R:=Input("%D SMA Periods",1,99,3);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update at last bar of frame}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new frame}
M:=Frac(Minute()/20)=0; {first bar of frame ?}
F:=0; {last bar of frame ?}
G:=LastValue(Highest(Sum(DayOfWeek()<>
ValueWhen(2,1,DayOfWeek()),5))=5);
F:=F OR G;
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+Q=2,1,(B=0)*J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
M:=G OR M;
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
Hw:=ValueWhen(1,Lw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Lw>0,Cw);
G:=Cum((Cw-LowestSince(K,J,Lw))*(J>0));
G:=G-ValueWhen(N+1,J,G);
I:=Cum((HighestSince(K,J,Hw)- LowestSince(K,J,Lw))*(J>0));
I:=I-ValueWhen(N+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*G/I;
Y:=Cum((J>0)*X);
Y:=(Y-ValueWhen(R+1,J,Y))/R;
X; {%K}
Y; {%D}
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|