[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weekly Stochastic and Momentum on Daily chart



PureBytes Links

Trading Reference Links

I had basically put the weekly indicators on daily charts thing on the
back burner for the time being, but someone mentioned the subject in an
off list e-mail, and I decided that maybe I should post these two
indicators.  They look right to me, but double check them.  Remember,
they plot the previous weeks value beginning the first trading day of
the following week, and that value remains constant throughout that
week.  These are designed for backtesting.....so if you just gotta know
on this Friday evening what the weekly value of the indicator is going
to be for the following week, simply look a weekly chart.

Stochastic:  The %K and %K slowing can be coded to accommodate more
parameters by using the user Input function,
but when you do this the %D always calculates using the default value of
the %K slowing, giving erroneous values.  So I just left it as is.  You
can plug in your own values...I just used the Metastock default values
as a starting point.  I made the %K and %D as two seperate indicators so
that you can plot the %D a different color and/or dashed.

The Momentum indicator uses the Input function just fine.

Let me know if if you find any errors.

Regards,
Ken
--
mailto:wander@xxxxxxxx


{This plots the Weekly Stochastic on Daily charts. -Ken}

   {`Wkly Stoch 5 per %K, slowing=3, no %D}

{end of week}
eow:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
yestClo:=If(eow>0,Ref(C,-1),0);

  {lowest low last 5 weeks}
LLow:=(ValueWhen(1,eow>0,
       Ref(LowestSince(5,eow>0=1,L),-1)));

  {highest high last 5 weeks}
HHigh:=(ValueWhen(1,eow>0,
        Ref(HighestSince(5,eow>0,H),-1)));

{5 per %K, slowing=3}
y:=(ValueWhen(1,eow>0,(yestClo-LLow))+
    ValueWhen(2,eow>0,(yestClo-LLow))+
    ValueWhen(3,eow>0,(yestClo-LLow)))/

((ValueWhen(1,eow>0,HHigh)+
  ValueWhen(2,eow>0,HHigh)+
  ValueWhen(3,eow>0,HHigh))-

(ValueWhen(1,eow>0,LLow)+
 ValueWhen(2,eow>0,LLow)+
 ValueWhen(3,eow>0,LLow)))*100 ;
y;

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

{`Wkly Stoch 3 per %D of a 5 per %K, slowing=3}

{end of week}
eow:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
yestClo:=If(eow>0,Ref(C,-1),0);

  {lowest low last 5 weeks}
LLow:=(ValueWhen(1,eow>0,
       Ref(LowestSince(5,eow>0,L),-1)));

  {highest high last 5 weeks}
HHigh:=(ValueWhen(1,eow>0,
        Ref(HighestSince(5,eow>0,H),-1)));

{5 per %K, slowing=3}
y:=(ValueWhen(1,eow>0,(yestClo-LLow))+
    ValueWhen(2,eow>0,(yestClo-LLow))+
    ValueWhen(3,eow>0,(yestClo-LLow)))/

((ValueWhen(1,eow>0,HHigh)+
  ValueWhen(2,eow>0,HHigh)+
  ValueWhen(3,eow>0,HHigh))-

(ValueWhen(1,eow>0,LLow)+
 ValueWhen(2,eow>0,LLow)+
 ValueWhen(3,eow>0,LLow)))*100;

{This plots the 3 period %D of the above.}
z:=(ValueWhen(1,eow>0,y)+ValueWhen(2,eow>0,y)+
    ValueWhen(3,eow>0,y))/3;
z

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

{`Wkly Momentum for DAILY Chart }

{This plots Weekly Momentum on Daily charts. -Ken}

n:=Input("Periods",1,20,10);
 {end of week}
eow:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);

(ValueWhen(1,eow>0,Ref(C,-1))/
 ValueWhen(n+1,eow>0,
 Ref(C,-1)))*100