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.

Hareketli Ortalama Moving Average - Phased by Jose Silva

Hareketli Ortalamalar Göstergeler arasında en çok kullanılan indikatördür. Trend takip eden özelliği bulunmakla birlikte son geçmişte kalan belli bir zaman diliminin ortalaması alınarak, şuan ki fiyatın trende ne derece uzak olduğunu gösterir.

algoritma

eiπ + 1 = 0
Algorithmist
Algoritma
Katılım
23 Eki 2020
Mesajlar
1,797
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: spr_boy <no_reply[at]yahoogroups.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Thursday, January 11, 2007, 1:33:55 PM
Subject: [EquisMetaStock Group] JMA in AB syntax
Files: Wiad.html
I found jurik formula for Amibroker but I dunno how to translate this formula into MS. Hopefully someone in this forum is willing to share a bit of his or her knowledge in coding

function JMA( array, per )
{
TN1=MA(array,per);
s1=0;
for( i = 0; i < per; i=i+1 )
{
s1=s1+((per-(2*i)-1)/2)*Ref(array,-i);
}
return TN1+(((per/2)+1)*S1)/((per+1)*per);
}
k=Param("Period",15,1,100,1);
J=JMA(C,k);
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Ed Hoopes <reefbreak_sd[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Friday, January 12, 2007, 6:26:53 AM
Subject: [EquisMetaStock Group] Re: JMA in AB syntax

Conceptually, this code is similar to the Zero Lag moving average which IS simple enough for MS-FL and available at several sites.

I don't think the AB JMA code can be done in MS-FL because of the lack of looping.

The TN1 array is easy enough - just a simple moving average of the closing price over 'per' bars.

s1 is a variable whose value is determined by looping over the 'per' number of periods. you would need to create a .dll with some external language like 'C' or whatever to compute s1.

the s1 value is then added to the TN1 moving average to create the Jurik moving average in the 'return' line.

The 'function' is present so that it can be repeatedly called from different spots in a larger routine, passing what ever 'array' and 'per' that is required.

Finally, the 'param' statement allows you to adjust the number of 'per's after the chart is displayed.

ReefBreak

PS
From comments I've read about this AB code, it is not EXACTLY the Jurik moving average, just an approximation.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Mark Jurik <mark_yahoo_equismetastock[at]jurikres.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Friday, January 12, 2007, 7:36:22 AM
Subject: [EquisMetaStock Group] Re: JMA in AB syntax


The code is simply a combination of a simple moving average and one way of approximating overall slope:

Result = SMA + slope

You can get the desired slope calc in MS by using the built-in linear regression slope function. This way, ...

Result = mov( data array, periods, simple )
+
linregslope( data array, periods ) * scaling_factor

You set the scaling factor as in input parameter, which allows you to adjust the amount of lag reduction. This approach to achieving low lag smoothing is NOT adaptive and has a significant overshoot penalty in proportion to the amount of lag reduction you request.

This formula poorly approximates JMA, which is adaptive, non-linear and has better lag/overshoot tradeoff properties. If you want the real thing, go to http://www.jurikres.com .

Mark Jurik
Jurik Research

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Ed Hoopes <reefbreak_sd[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Friday, January 12, 2007, 5:13:01 PM
Subject: [EquisMetaStock Group] Re: JMA in AB syntax


Mark, I have also found that adding variable smoothing does help things - sometimes considerably. Even MS has a volatility based adjustable moving average with the VAR switch in the 'mov' function. But, as I'm sure you know, there are many ways to do the adjustments.

ReefBreak

PS
The formula MS gives for VAR in the user guide(p473) is wrong (as of Ver9) better go to the source in TASC.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Friday, January 12, 2007, 5:00:58 PM
Subject: [EquisMetaStock Group] JMA approximation for MetaStock


The Metastock code below is based on Mark Jurik's post, and in no way is it meant to replace the original JMA available from http://www.jurikres.com .

MetaStock -> Tools -> Indicator Builder -> New
-> copy & paste complete formula between "---8<---" lines.

==========
MA - Jurik
==========
---8<-------------------------------------------

{ Non-adaptive approximation of Mark Jurik's JMA
available from http://www.jurikres.com - v1.0

CCopyright 2007 Jose Silva.
For personal use only.
http://www.metastocktools.com }

{ User inputs }
pds:=Input("JMA periods",1,2600,21);
factor:=Input("Lag reduction scaling factor [-1 = Auto]",-1,1000,-1);
x:=Input("use [1]Open [2]High [3]Low [4]Close [5]WCl [6]Vol",1,6,4);
type:=Input("[1]EMA [2]SMA [3]TmSr [4]Tri [5]Var [6]Vol [7]Wght",1,7,2);
shift:=Input("JMA bands spread %",0,100,5)/100;
plot:=Input("[1]JMA, [2]JMA+Bands, [3]Band crossover Signals",1,3,1);

{ Data array }
x:=If(x=1,O,
If(x=2,H,
If(x=3,L,
If(x=4,C,
If(x=5,WC(),
V)))));

{ MovAvg type:
1 - Exponential MA
2 - Simple MA
3 - Time Series MA
4 - Triangular MA
5 - Variable MA
6 - Volume adjusted MA
7 - Weighted MA }
ma:=
If(type=1,Mov(x,pds,E),
If(type=2,Mov(x,pds,S),
If(type=3,Mov(x,pds,T),
If(type=4,Mov(x,pds,TRI),
If(type=5,Mov(x,pds,VAR),
If(type=6,Mov(x,pds,VOL),
Mov(x,pds,W)))))));

{ JMA approximation }
factor:=If(factor>=0,factor,pds/4);
JMA:=(ma+LinRegSlope(x,pds)*factor);

{ JMA % bands }
upper:=JMA*(1+shift);
lower:=JMA*(1-shift);

{ JMA bands crossover signals }
entry:=Cross(C,upper);
exit:=Cross(lower,C);

{ Clean signals }
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
long:=bin*(Alert(bin=0,2)
OR entry*Cum(entry)=1);
short:=(bin=0)*(Alert(bin,2)
OR exit*Cum(exit)=1);
signals:=long-short;

{Plot JMA on price chart, signals in own window}
If(plot=1,JMA,If(plot=2,upper,0));
If(plot=1,JMA,If(plot=2,lower,0));
If(plot=3,signals,JMA)

---8<-------------------------------------------

jose '-)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Tuesday, January 16, 2007, 12:13:31 AM
Subject: [EquisMetaStock Group] Phased MA for MetaStock

My last posted code may have generated some confusion - better to change "JMA" for "PMA" just in case some of these good people get upset:

JMA Inc.
JMA Forensics
JMA Groups
JMA Graphics
JMA Software
JMA Legal
JMA Consulting
JMA Engineering
Japan Medical Association
Japan Meteorological Agency
Japan Management Association
Japan Marketing Association
Jamaica Manufacturers' Association
John Mitchell & Associates
Jurik Moving Average

MetaStock -> Tools -> Indicator Builder -> New
-> copy & paste complete formula

Moving Average - Phased

{ PMA v1.0 -- Phased Moving Average.
As suggested by Mark Jurik of Jurik Research,

CCopyright 2007 Jose Silva.
For personal use only.
http://www.metastocktools.com }

{ User inputs }
pds:=Input("PMA periods",1,2600,21);
factor:=Input("Lag reduction scaling factor [-1 = Auto]",-1,1000,-1);
x:=Input("use [1]Open [2]High [3]Low [4]Close [5]WCl [6]Vol",1,6,4);
type:=Input("[1]EMA [2]SMA [3]TmSr [4]Tri [5]Var [6]Vol [7]Wght",1,7,2);
shift:=Input("PMA bands spread %",0,100,5)/100;
plot:=Input("[1]PMA, [2]PMA+Bands, [3]Band crossover Signals",1,3,1);

{ Data array }
x:=If(x=1,O,
If(x=2,H,
If(x=3,L,
If(x=4,C,
If(x=5,WC(),
V)))));

{ MovAvg type:
1 - Exponential MA
2 - Simple MA
3 - Time Series MA
4 - Triangular MA
5 - Variable MA
6 - Volume adjusted MA
7 - Weighted MA }
ma:=
If(type=1,Mov(x,pds,E),
If(type=2,Mov(x,pds,S),
If(type=3,Mov(x,pds,T),
If(type=4,Mov(x,pds,TRI),
If(type=5,Mov(x,pds,VAR),
If(type=6,Mov(x,pds,VOL),
Mov(x,pds,W)))))));

{ PMA approximation }
factor:=If(factor>=0,factor,pds/4);
PMA:=(ma+LinRegSlope(x,pds)*factor);

{ PMA % bands }
upper:=PMA*(1+shift);
lower:=PMA*(1-shift);

{ PMA bands crossover signals }
entry:=Cross(C,upper);
exit:=Cross(lower,C);

{ Clean signals }
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
long:=bin*(Alert(bin=0,2)
OR entry*Cum(entry)=1);
short:=(bin=0)*(Alert(bin,2)
OR exit*Cum(exit)=1);
signals:=long-short;

{Plot PMA on price chart, signals in own window}
If(plot=1,PMA,If(plot=2,upper,0));
If(plot=1,PMA,If(plot=2,lower,0));
If(plot=3,signals,PMA)​
jose
http://www.metastocktools.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Ron Berlin <rsb_44[at]hotmail.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Tuesday, January 16, 2007, 3:05:34 PM
Subject: [EquisMetaStock Group] Phased MA for MetaStock
Not sure that change is a good one.
Produce Marketing Association
Photo Marketing Association
Precision Metalforming Association
Pacific Maritime Association
Promotion Marketing Association
Pilates Method Alliance
Philippine Military Academy
Property Management Association
Just for a start...
;-)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Lionel Issen <lissen[at]sbcglobal.net>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Tuesday, January 16, 2007, 5:41:51 PM
Subject: [EquisMetaStock Group] Phased MA for MetaStock

Really now, just consider the context in which a word/acronym appears.

Lionel
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: pumrysh <no_reply[at]yahoogroups.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Tuesday, January 16, 2007, 12:50:04 AM
Subject: [EquisMetaStock Group] Re: Phased MA for MetaStock

Or JMO for just my opinion.

Seriously, I tried the code and enjoyed the plot it gave. Thanks to you and Mark for the help with it. Kinda suprised that no one has jumped on making it adaptive though.

Preston
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Tuesday, January 16, 2007, 1:03:10 AM
Subject: [EquisMetaStock Group] Re: Phased MA for MetaStock


Hmmm... adaptive to what?

Actually, by default the PMA's "Lag reduction scaling factor" is adaptive to the MA's periodicity.

jose '-)
http://www.metastocktools.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: pumrysh <no_reply[at]yahoogroups.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Tuesday, January 16, 2007, 5:38:21 AM
Subject: [EquisMetaStock Group] Re: Phased MA for MetaStock

My thoughts exactly! As of this point I haven't tried anything but was thinking of using some type of momentum oscillator.

Preston​
Source / From:
Metastockusers[at]yahoogroups[dot]com
 

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
Başlatan Benzer Konular Forum Cevap Tarih
algoritma A 5
algoritma S 0
algoritma T 0
algoritma H 0
algoritma T 0
algoritma P 0
algoritma W 0
algoritma Kurgusal Stratejiler - Beyin Fırtanası 0
A V 0
Bogac S 0
Bogac A 0
algoritma Matriks 0
U V 1
K D 0
algoritma Dikkat Çeken Önemli Formüller 3
algoritma # 0
algoritma Teknik Analiz Tanımlamalar 0
algoritma Teknik Analiz Tanımlamalar 0
algoritma Teknik Analizde Göstergelerin Matematiksel Açıklamaları 0
algoritma Teknik Analizde Göstergelerin Matematiksel Açıklamaları 0