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 Vidya UpTo64 by Jan Willem Roberts

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
-----Original Message-----

From: J.W.E Roberts <jan.roberts@xxxxxxxxxxxxxxxxx>
To: Steven Buss <sbuss@xxxxxxxxxxx>
Cc: Richard Estes <restes@xxxxxxxxx>; metastock-list@xxxxxxxxxxxxx
<metastock-list@xxxxxxxxxxxxx>
Date: Wednesday, February 11, 1998 1:48 PM
Subject: Re: Multi-Period Indicators


Hi Folks,having gotten so much free advice & tips from this forum, I thought it's time to contribute something myself.


Paul Chivers on 1/14/98 wrote:

"I agree that MetaStock DOES NOT SUPPORT Multi-Period Market Indicators."

Yeah... After buying The New Technical Trader, I was all fired up to try out VIDYA in MS6.5. Alas, no dice. Now, I'm a programmer, and programmers cannot take no for an answer (careful with this species, ladies), and do I wrote a kludge to do it anyhow that I'd like to present here for Your August Opinion.
The problem is that it behaves rather erratically, and I cannot quite figure out wether this is caused by A. an error on my side (near impossible (programmers have the second largest egos in the world (right after fighter pilots))), or​
B. something inherent to The Kludge, or
C. becaus Vidya _does_ kind of jump all over the place.

OK, here goes:

1. Create a function for the number of days. I'll use CMO(10) as an example:​

DaysCMO10
Int(0.5*Abs(Mov(CMO(C,10),3,S)))
{I use a bit of smoothing, else the # of days changes too abruptly.}
2. Create a function that calls this function - the rationale will become clear soon:​

VidyaDays
Fml("DaysCMO10")
{Fml("DaysRsquared") } {(another one to play around with)}
3. Now create 4 funs that return a moving average:

3A:​

Vidya00_15
x:= Fml("VidyaDays");
If(x>15,
0
{else: Present Range},
If(x<8,
If(x<4,
If(x<2,
Mov( C, 1, E ) {an interesting MA, isn't it}
{# else x>=2},
If(x<3,
Mov( C, 2, E )
{# else},
Mov( C, 3, E )
)
){x<2?}
{# else x>=4},
If(x<6,
If(x<5,
Mov( C, 4, E )
{# else},
Mov( C, 5, E )
)
{# else x>=6},
If(x<7,
Mov( C, 6, E )
{# else},
Mov( C, 7, E )
)
){x<6?}
){x<4?}
{# else x>=8},
If(x<12,
If(x<10,
If(x<9,
Mov( C, 8, E )
{# else},
Mov( C, 9, E )
)
{# else x>=10},
If(x<11,
Mov( C, 10, E )
{# else},
Mov( C, 11, E )
)
){x<10?}
{# else x>=12},
If(x<14,
If(x<13,
Mov( C, 12, E )
{# else},
Mov( C, 13, E )
)
{# else x>=14},
If(x<15,
Mov( C, 14, E )
{# else},
Mov( C, 15, E )
)
){x<14?}
){x<12?}
){x<8?}
)
This beastie does a kind of binary search for the MA we wish as its result. This is the fastest way. Throw out the comments & spaces at will. Because I know what a lazy bunch you all are, here come the other three:​
3B.:​

Vidya16_31
x:= Fml("VidyaDays");
If(x<16 OR x>31,
0
{else: Present Range},
If(x<24,
If(x<20,
If(x<18,
If(x<17,
Mov( C, 16, E )
{# else},
Mov( C, 17, E )
)
{# else x>=18},
If(x<19,
Mov( C, 18, E )
{# else},
Mov( C, 19, E )
)
){x<18?}
{# else x>=20},
If(x<22,
If(x<21,
Mov( C, 20, E )
{# else},
Mov( C, 21, E )
)
{# else x>=22},
If(x<23,
Mov( C, 22, E )
{# else},
Mov( C, 23, E )
)
){x<22?}
){x<20?}
{# else x>=24},
If(x<28,
If(x<26,
If(x<25,
Mov( C, 24, E )
{# else},
Mov( C, 25, E )
)
{# else x>=26},
If(x<27,
Mov( C, 26, E )
{# else},
Mov( C, 27, E )
)
){x<26?}
{# else x>=28},
If(x<30,
If(x<29,
Mov( C, 28, E )
{# else},
Mov( C, 29, E )
)
{# else x>=30},
If(x<31,
Mov( C, 30, E )
{# else},
Mov( C, 31, E )
)
){x<30?}
){x<28?}
){x2<24?}
)
3C:​

Vidya32_47
x:= Fml("VidyaDays");
If(x<32 OR x>47,
0
{else: Present Range},
If(x<40,
If(x<36,
If(x<34,
If(x<33,
Mov( C, 32, E )
{# else},
Mov( C, 33, E )
)
{# else x>=34},
If(x<35,
Mov( C, 34, E )
{# else},
Mov( C, 35, E )
)
){x<34?}
{# else x>=36},
If(x<38,
If(x<35,
Mov( C, 36, E )
{# else},
Mov( C, 37, E )
)
{# else x>=38},
If(x<39,
Mov( C, 38, E )
{# else},
Mov( C, 39, E )
)
){x<38?}
){x<36?}
{# else x>=40},
If(x<44,
If(x<42,
If(x<41,
Mov( C, 40, E )
{# else},
Mov( C, 41, E )
)
{# else x>=42},
If(x<43,
Mov( C, 42, E )
{# else},
Mov( C, 43, E )
)
){x<42?}
{# else x>=44},
If(x<46,
If(x<45,
Mov( C, 44, E )
{# else},
Mov( C, 45, E )
)
{# else x>=46},
If(x<47,
Mov( C, 46, E )
{# else},
Mov( C, 47, E )
)
){x<46?}
){x<44?}
){x<40?}
)
3D:​

Vidya48_63
x:= Fml("VidyaDays");
If(x<32 OR x>63,
0
{else: Present Range},
If(x<56,
If(x<52,
If(x<50,
If(x<49,
Mov( C, 48, E )
{# else},
Mov( C, 49, E )
)
{# else x>=50},
If(x<51,
Mov( C, 50, E )
{# else},
Mov( C, 51, E )
)
){x<50?}
{# else x>=52},
If(x<54,
If(x<53,
Mov( C, 52, E )
{# else},
Mov( C, 53, E )
)
{# else x>=54},
If(x<55,
Mov( C, 54, E )
{# else},
Mov( C, 55, E )
)
){x<54?}
){x<52?}
{# else x>=56},
If(x<60,
If(x<58,
If(x<57,
Mov( C, 56, E )
{# else},
Mov( C, 57, E )
)
{# else x>=58},
If(x<59,
Mov( C, 58, E )
{# else},
Mov( C, 59, E )
)
){x<58?}
{# else x>=60},
If(x<62,
If(x<61,
Mov( C, 60, E )
{# else},
Mov( C, 61, E )
)
{# else x>=62},
If(x<63,
Mov( C, 62, E )
{# else x>=63!!!},
Mov( C, 63, E )
)
){x<62?}
){x<60?}
){x<56?}
)
4. Almost done; the last one pulls it all together:​

VidyaUpTo64
x:=Fml("VidyaDays");
If(x<5,
{Arbitrarily use 5 days as the minimum time frame}
Mov(C,5,E)
{else},
If(x>=64,
{64 days is the maximum we can handle (so far)}
Mov(C,64,E)
{else},
If(x<32,
If(x<16,
Fml("Vidya00_15")
{else x>=16},
Fml("Vidya16_31")
)
{else x>=32},
If(x<48,
Fml("Vidya32_47")
{else x>=48},
Fml("Vidya48_63")
)
)
)
)​

It really works - somehow. Don't take my word for it but please try it out for
yourselves.

It would have been easy to extend the time frames but this is how far my masochism would carry me. Of course I started out with one _big_ binary search but MS won't let you: The maximum number of different numerical constants it accepts is 20.
If you want different formulas for the variable time frames, eg. Using Linear Regression, Directional Movement or whatever, just create a function, call t in VidyaDays, and presto, you have a different Vidya. The disadvantage being that no direct comparisons are possible without more cutting & pasting but a kludge is a kludge is ...​
Have fun & happy trading,

Jan Willem Roberts

[4754]​
Source / From:
 

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