Teknik Analiz Dünyasına Hoşgeldiniz

Paylaşmak Güzeldir.

  • DİKKAT: Formüller, Sistemler sadece eğitim amaçlıdır. Alım satım, olası anapara kaybı ve diğer kayıplar dahil olmak üzere "YÜKSEK RİSK içerir.
  • Mucize teknik gösterge yoktur, sadece doğru veya yanlış kullanılan göstergeler vardır.

Oscillator Weekly ADX by Roy Larsen

Teknik analizde fiyatın yönü veya trendin devamıyla ilgili fikir veren matematiksel modellerdir. Trend oluşmamış piyasalarda fiyatlar yatay bir bantta hareket ederken trendin içinde düzeltme seviyelerini tespit eden indikatörlere OSİLATÖR denir

algoritma

e iπ +1=0
Katılım
23 Eki 2020
Mesajlar
1,349
Puanları
63
From: samuel leung <samuelleung88960[at]yahoo.com.hk>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Sunday, January 29, 2006, 6:06:25 AM
Subject: [EquisMetaStock Group] Weekly +DI on daily chart
Hello Roy,

I'm trying to write the weekly +DI indicator (and also the weekly -DI indicator) on daily chart.

As there are codes of weekly ADX on daily chart written by you below, I think the weekly +DI indicator can be got by modifying some lines with in {{{ }}} below. However, the result is not correct. Please help to share the hint the way to fix it.

Thanks in advance.

Regards,
Samuel

A prerequisite for this indicator is Jose Silva's "Calendar Week counter"."Weekly ADX" plots a weekly ADX signal on any daily chart. The construction is not quite true to the standard MetaStock"Directional Movement ADX" indicator and therefore the plot values also will differ slightly.​

Weekly ADX

{(c)2004 Roy Larsen, rlarsen[at]man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly ADX Periods",1,99,10); X:=1/N;
F:=Input("End of Week, 5=Friday 6=Saturday 7=Sunday",5,7,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update on Friday when possible}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
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=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(1,Ci>0,Ci); Ci:=ValueWhen(2,J,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND
Lo<Li AND (Ho-Hi)>(Li-Lo),Ho-Hi,0));
Mdm:=If(Lo<Li AND Ho<=Hi,Li-Lo,If(Ho>Hi AND
Lo<Li AND (Ho-Hi)<(Li-Lo),Li-Lo,0));
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<N+1,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
I:=If(Cum(J>0)<N+1,Cum((J>0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/A;
M:=If(Cum(J>0)<N+1,Cum((J>0)*Mdm)/N, ValueWhen(1,J,PREV)*(1-X)+Mdm*X);
M:=100*M/A;
M:=Abs(I-M)/(I+M);
F:=ValueWhen(1,J,PREV)*(1-X)+M*X;
100*If(ValueWhen(N+1,J,F)>0,F,F);​

Weekly ADX Modification 1

{(c)2004 Roy Larsen, rlarsen[at]man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly ADX Periods",1,99,10); X:=1/N;
F:=Input("End of Week, 5=Friday 6=Saturday 7=Sunday",5,7,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2);
{0=Display, update on Friday when possible}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
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=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(1,Ci>0,Ci); Ci:=ValueWhen(2,J,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND
Lo<Li AND (Ho-Hi)>(Li-Lo),Ho-Hi,0));

{Mdm:=If(Lo<Li AND Ho<=Hi,Li-Lo,If(Ho>Hi AND
Lo<Li AND (Ho-Hi)<(Li-Lo),Li-Lo,0));}

R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<N+1,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);

I:=If(Cum(J>0)<N+1,Cum((J>0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/A;

{M:=If(Cum(J>0)<N+1,Cum((J>0)*Mdm)/N, ValueWhen(1,J,PREV)*(1-X)+Mdm*X);
M:=100*M/A;
M:=Abs(I-M)/(I+M);}

F:=ValueWhen(1,J,PREV)*(1-X)+I*X; {M is changed to I}
100*If(ValueWhen(N+1,J,F)>0,F,F);

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Roy Larsen <rlarsen[at]man.quik.co.nz>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Sunday, January 29, 2006, 7:12:51 PM
Subject: [EquisMetaStock Group] Weekly +DI on daily chart
Hi Samuel
The "I" variable is actually +DI, And Rounding it should give identical values to the MetaStock function. Use the "Round(M)" for -DI.
There is a problem with my weekly ADX-related formulas when plotted on weekly charts, and that is that the first 6 -10 months is way off the scale. This is an issue with seeding (assigning a beginning value) one or more of the Wilders Smoothing variables (variables with PREV). I'll take a look at it soon.
Regards
Roy​

Weekly ADX Modification 2
{2004 Roy Larsen, rlarsen[at]man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}

N:=Input("Weekly ADX Periods",1,99,10); X:=1/N;
F:=Input("End of Week, 5=Friday 6=Saturday 7=Sunday",5,7,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,1);
{0=Display, update on Friday when possible}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
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=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(1,Ci>0,Ci); Ci:=ValueWhen(2,J,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND
Lo<Li AND (Ho-Hi)>(Li-Lo),Ho-Hi,0));
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<N+1,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
I:=If(Cum(J>0)<N+1,Cum((J>0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/A;
Round(I);​

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Roy Larsen <rlarsen[at]man.quik.co.nz>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Sunday, January 29, 2006, 8:18:54 PM
Subject: [EquisMetaStock Group] Weekly +DI on daily chart
Hi Samuel
Here are revised versions of the Weekly +DI and Weekly ADX indicators. Changes have been made affecting the "Pdm" and "I" variables (and "M" for Weekly ADX). Further changes may follow.
Regards
Roy​

Weekly +DI - Revised

{c 2004-2006 Roy Larsen, www.metastocktips.co.nz}
{for use on daily charts with Jose Silva's "Calendar Week counter"}

N:=Input("Weekly ADX Periods",1,99,10); X:=1/N;
F:=Input("End of Week, 5=Friday 6=Saturday 7=Sunday",5,7,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,1);
{0=Display, update on Friday when possible}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
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=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(1,Ci>0,Ci); Ci:=ValueWhen(2,J,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND Lo<Li AND (Ho-Hi)>(Li-Lo),Ho-Hi,0));
Pdm:=If(Cum(J>0)<3,0,Pdm);
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<N+1,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
I:=If(Cum(J>0)<N+1,Cum((J>0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/ValueWhen(1,Cum(J>0)>N,A);
Round(I);​

Weekly ADX - Revised

{(c) 2004-2006 Roy Larsen, www.metastocktips.co.nz}
{for use on daily charts with Jose Silva's "Calendar Week counter"}

N:=Input("Weekly ADX Periods",1,99,14); X:=1/N;
F:=Input("End of Week, 5=Friday 6=Saturday 7=Sunday",5,7,5);
Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,0);
{0=Display, update on Friday when possible}
{1=Display, update on each new bar}
{2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
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=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(1,Ci>0,Ci); Ci:=ValueWhen(2,J,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND Lo<Li AND (Ho-Hi)>(Li-Lo),Ho-Hi,0));
Pdm:=If(Cum(J>0)<3,0,Pdm);
Mdm:=If(Lo<Li AND Ho<=Hi,Li-Lo,If(Ho>Hi AND Lo<Li AND (Ho-Hi)<(Li-Lo),Li-Lo,0));
Mdm:=If(Cum(J>0)<3,0,Mdm);
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)<N+1,Cum((J>0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
I:=If(Cum(J>0)<N+1,Cum((J>0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/ValueWhen(1,Cum(J>0)>N,A);
M:=If(Cum(J>0)<N+1,Cum((J>0)*Mdm)/N, ValueWhen(1,J,PREV)*(1-X)+Mdm*X);
M:=100*M/ValueWhen(1,Cum(J>0)>N,A);
M:=Abs(I-M)/(I+M);
F:=ValueWhen(1,J,PREV)*(1-X)+M*X;
X:=100*If(ValueWhen(N+1,J,F)>0,F,F);
X;

Hello Roy,

Thank you for your help.

Regards,
Samuel​
Source / From:
Metastockusers[at]yahoogroups[dot]com
 

Forumda daha fazla yararlanmak için giriş yapın yada üye olun!

Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!

Kayıt ol

Forumda bir hesap oluşturmak tamamen ücretsizdir.

Şimdi kayıt ol
Giriş yap

Eğer bir hesabınız var ise lütfen giriş yapın

Giriş yap