[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] metastock 6.52 nesting variables



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.
 




Courtesy of Guppy:
 
<FONT 
face="Times New Roman" color=#004080 size=6>Vidya 21, 
5This is the 
MetaStock code for VIDYA 21,5 which applies to the article "Breaking Out Of 
Price Channels" by Gerald Marisch in the TASC January 1998 
edition.Length:=Input("Length",1,200,21);Smooth:=Input("Smoothing",1,200,5);AbsCMO:=(Abs(CMO(C,Length)))/100;SC:=2/(Smooth+1);VIDYA:=If(Cum(1)<=(Length+1),C,(SC*AbsCMO*CLOSE)+(1-(SC*AbsCMO))*PREV);VIDYAfrom 
Ian Burgogyne<A 
name="Vidya with P variable, version II">Vidya with 
P variable, version II<FONT 
face="Times New Roman" size=3>My version of Tushar Chande's Vidya, using the P 
variableVidya{P}Periods:=Input("length of 
MA",5,100,20);K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);A:=(2/(Periods+1));Vidya:=A*K*(P)+(1-A*K)*Ref(P,-1);Vidya;Tar(SZ)an 
LongC-(((462*Mov(C,34,E))-(420*Mov(C,13,E))+(490*(Mov(Mov(C,13,E)-Mov(C,34,E),89,E))))/42)Tar(SZ)an 
Short(C-(((325*Mov(C,26,E))-(297*Mov(C,12,E))+(351*Mov(Mov(C,13,E)-Mov(C,26,E),9,E))))/28)*2from 
Barry Marx<FONT 
face="Times New Roman" color=#004080 size=6>Vidya 
ExplanationVidya 
is a subject that comes up with some regularity. It's actually available in 
MetaStock as the Variable Moving Average (Mov(C,n,V) but Equis, for their own 
inscrutable reasons, choose not to identify it by name. If you refer to the 
MetaStock manual, be aware that there is a typo in the formula (0.078 should 
read 0.78). Two or three years ago I coded the version given in TAS&C and it 
overlaid the MetaStock version precisely, except that at the time the MetaStock 
version was not correctly initialised -- this has since been corrected. Equis 
acknowledged the typo at the time, but have done nothing about it.As far 
as the 'circular reference' is concerned, you are right that eventually you run 
out of data. However adding a portion of yesterday's value to a portion of 
today's value is common to several indicators, such as the Exponential Moving 
Average. If no provision is made, then usually the indicator will start with a 
value of zero, rise rapidly at first, then take some time to stabilise. 
One answer is to initialise it. For a Vidya of the close, period N, you 
can initialise with something like "If(Cum(1) < N, C,{else} ...)" with the 
Vidya formula as the 'else'. Then at day N the indicator uses the (N-1) close 
for yesterday's data and takes much less time to stabilise.from 
HHP<FONT 
face="Times New Roman" color=#004080 size=6>Vidya using P variable, 
version IHere is 
a version of Vidya using a P variable that matches MetaStock's built-in Variable 
Moving Average. You can overlay them in different colours on the same chart to 
satisfy yourself that they are indeed the same (but remember to use the same 
number of periods). There is a small difference at the start due to different 
initialisation, after which they are identical. The coding is spelled out for 
the benefit of anyone studying the book. It can be adapted by adding a variable 
input for the CMO length (9), or made universal by replacing each C with a P, or 
the Abs(CMOsc) can be replaced with a different volatility index that ranges 
between 0 and 1.{Vidya (Chande)}Pds:= Input("Number of 
Periods?",1,1000,20);Alpha:= 2/(Pds+1);{Chande Momentum 
Oscillator}{UD = Up day}{DD = Down day}UD:= 
Sum((C-Ref(C,-1))*(C>Ref(C,-1)),9);DD:= 
Sum((Ref(C,-1)-C)*(C<Ref(C,-1)),9);CMOsc:= (UD-DD)/(UD+DD);k:= 
Abs(CMOsc);Vidya:= (Cum(1) < Pds) * C + (Cum(1)>=Pds) * ((Alpha * 
k * C) + (1-Alpha* k) * PREV);Vidya
<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.