PureBytes Links
Trading Reference Links
|
You cannot reply to this message via email because you have chosen not
to disclose your email address to the group. Please use this
page to reply.
I have tried this earlier only to find out that it
is not possible using the mov(X,Y,Z) function.
Try:
"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.<FONT
size=3>
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<FONT
size=3>B. something inherent to The Kludge, orC. 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:
<FONT
size=3>DaysCMO10Int(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:
<FONT
size=3>VidyaDaysFml("DaysCMO10"){Fml("DaysRsquared")
} {(another one to play around with)}
3. Now create 4 funs that return a moving
average:3A:
<FONT
size=3>Vidya00_15x:=
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:<FONT
size=3>3B.:
<FONT
size=3>Vidya16_31x:= 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:
<FONT
size=3>Vidya32_47x:= 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:
<FONT
size=3>Vidya48_63x:= 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:
<FONT
size=3>VidyaUpTo64x:=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")))))
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
----- Original Message -----
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black">From:
<A title=BRIANKENYN@xxxxxxx
href="mailto:BRIANKENYN@xxxxxxx">BRIANKENYN@xxxxxxx
To: <A
title=equismetastock@xxxxxxxxxxxxxxx
href="mailto:equismetastock@xxxxxxxxxxxxxxx">equismetastock@xxxxxxxxxxxxxxx
Sent: Sunday, October 06, 2002 4:10
PM
Subject: [EquisMetaStock Group] metastock
6.52 nesting variables
Hi- I'm new to this net. I am trying to nest a varible in a
moving average in place of a close in order to create an adaptive
moving average. The ultimate purpose is to create the VIDYA
Dynamic Average introduced by Tushar Chande.Does anyone know if it can
be done with 6.52?BrianTo
unsubscribe from this group, send an email
to:equismetastock-unsubscribe@xxxxxxxxxxxxxxxYour
use of Yahoo! Groups is subject to the <A
href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|