Teknik Analiz Dünyasına Hoşgeldiniz. Paylaşmak Güzeldir.

Yayından kaldırmak istediğiniz formüller için algoritmabul@gmail.com ile iletişime geçebilirsiniz... 

  • 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 Chande's Adaptive Stochastic Oscillator

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

eiπ + 1 = 0
Algorithmist
Algoritma
Katılım
23 Eki 2020
Mesajlar
1,797
---- Original Message -----
From: Dave Nadeau
To: metastock@xxxxxxxxxxxxx
Sent: Thursday, June 29, 2000 12:40 PM
Subject: Re: adaptive stochastic oscillator

Here's what I come up with. It doesn't work, and I've run into this issue when trying to solve some other problems. Does anyone have any ideas for circumventing the problem of putting a variable into the "periods" part of the HHV or LLV functions?

This gives an error when you try to put the code below into Metastock (in blue):
--------------------------------------------------------------------------------------------------
{-- © 2K Tushar Chande; Adaptive Stochastic Oscillator --}
vars: v1(0), v2(0), v3(0), v4(0) ;
vars: lenmax(28), lenmin(7), currlen(0) ;
vars: hh(0), ll(0), stoch(0), stochma(0) ;

lenmax:= 28;
lenmin:= 7;
currlen:= 0;
{-- Calculate 20-day std. Dev. And its 20-day range --}
v1 = stddev(c,20) ;
v2 = highest(v1, 20) ;
v3 = lowest(v1, 20) ;
v1:= Stdev(Close, 20);
v2:= HHV(v1,20);
v3:= LLV(v1,20);
{-- Create v4: stochastic oscillator for 20-day std. dev. --}
{-- if v1=v2 (highest level) => v4 = 1; if v1=v3 (lowest level) => v4=0 --}
if (v2-v3) > 0 then v4 = ((v1 - v3)/(v2-v3)) Else v4 = 0 ;
v4:=If((v2-v3)>0,((v1 - v3)/(v2-v3)),0);
{-- Calculate current effective length; if v4 = 1, then length = mininum --}
currlen = IntPortion(lenmin + (lenmax-lenmin)*(1-v4)) ;
currlen:= If(v4=1,lenmin,(Int(lenmin + (lenmax-lenmin)*(1-v4))));
{-- Calculate stochastic oscillator and its 3-day exponential average --}
hh = highest(h, currlen) ;
ll = lowest(l, currlen) ;
if (hh-ll) > 0 then stoch = ((close - ll)/(hh - ll)) * 100 ;
if currentbar = 1 then stochma = 0 else
stochma = 0.5*stoch + 0.5*stochma[1] ;
hh:= HHV(High, currlen);
ll:= LLV(Low, currlen);
stoch:=If(((hh-ll)>0,((close - ll)/(hh - ll)) * 100,50) {I set the error condition to a stochastic midpoint...I'm open to any other ideas???}
stochma:= (.5*stoch)+(.5*Ref(stoch,-1))
{-- Plot data --}
plot1(stoch, "adapt_stoch") ;
plot2(stochma, "stochma") ;
plot3(80, "hi_ref") ;
plot4(20, "lo_ref") ;
stoch; stochma; 80; 20;
{ -- End of code --}
----------------------------------
Dave Nadeau


Re: adaptive stochastic oscillator

* To: metastock@xxxxxxxxxxxxx
* Subject: Re: adaptive stochastic oscillator
* From: Dave Nadeau <dave.nadeau@xxxxxxxx>
* Date: Fri, 30 Jun 2000 13:15:16 -0700
* Organization: @Home Network Member
* References: <003701bfe16f$d92a22e0$0c8958ca@xxxxxxxxxxx>
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx

Glen and Ken, Thank you! The LastValue() will really help many of my coding challenges! That's what I needed. To try to solve this or other problems, I just start reading through the functions section of my users manual. I got very wrapped around trying to get creative with the HIGHESTSINCE function and the SUM function, but ended up with the same difficulties. This has been a great learning process. I agree with the smoothing function. It does a lot better. Dave Nadeau

[20367]


Re: adaptive stochastic oscillator

* To: "MetaStock listserver" <metastock@xxxxxxxxxxxxx>
* Subject: Re: adaptive stochastic oscillator
* From: "Glen Wallace" <gcwallace@xxxxxxxx>
* Date: Fri, 30 Jun 2000 12:00:45 -0700
* References: <003701bfe16f$d92a22e0$0c8958ca@xxxxxxxxxxx>
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx


Dave:

A couple comments. You can get around the problem with variables in the HHV and LLV functions by using LastValue(currlen) rather than just currlen. Also, the smoothing in the definition of stochma will give you a simple moving average instead of exponential. Instead, try stochma:= Mov(stoch, 3, Exponential);

You also need a different variable name for stoch, since this is also a function name.

Regards.

[20368]


Re: adaptive stochastic oscillator

* To: metastock@xxxxxxxxxxxxx
* Subject: Re: adaptive stochastic oscillator
* From: iamken <iamken@xxxxxxxxxxxxxxx>
* Date: Fri, 30 Jun 2000 14:37:01 -0400
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx

Re: Chande's Adaptive Stochastic Oscillator on page 10 of the S&C July issue.

>...I'm open to any other ideas???

Ok, then here's my interpertation, but I can't say for certain that it's right. Looks like it could stand to be smoothed, so in the second verision (at bottom), it is. By the way, I went ahead and added an input for the volatility lookback period.

Ken

[20369]​

Chande's Adaptive Stochastic Oscillator
n:=Input("**Volatility** lookback length",1,50,20);
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));
RawStoch:=((C-ll)/(hh-ll))*100;
stochma:=(.5*RawStoch)+(.5*PREV);
20;
80;
stochma;
RawStoch;

Chande's Adaptive Stochastic Oscillator - Smoothed Version
n:=Input("**Volatility** lookback length",1,50,20);
x:=Input("%K smoothing (exponential smoothing)",1,50,3);
y:=Input("%D smoothing (exponential smoothing)",1,50,3);
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));
RawStochK:=((C-ll)/(hh-ll))*100;
SmoothedStochK:=Mov(RawStochK,x,E);
StochD:=Mov(SmoothedStochK,y,E);
20;
80;
StochD;
SmoothedStochK;​

 

Forumdan 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