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

RE: [EquisMetaStock Group] EMA indicator code



PureBytes Links

Trading Reference Links

A while back I came across Wilder's suggestion on EMAs. At the time another
suggestion was to use a starting point of 3 times the length of the EMA.

 

The value of an EMA is calculated by using all the previous data values
hence the current value of an EMA depends on the starting point. Don't worry
about very precise values, it's an indicator not a micrometer. 

 

Lionel.

 

  _____  

From: equismetastock@xxxxxxxxxxxxxxx [mailto:equismetastock@xxxxxxxxxxxxxxx]
On Behalf Of Roy Larsen
Sent: Sunday, March 26, 2006 2:23 PM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: Re: [EquisMetaStock Group] EMA indicator code

 

Hi Mano


Here are my versions of these indicators. The critical aspect of getting
these formulas to plot correctly in the early bars is "seeding", i.e. the
starting value used. An EMA starts from the target data array on bar one.
Wilders Smoothing starts with the equivalent Simple Moving Average on bar
"N", where "N" is periods.

{Exponential Moving Average}
N:=Input("Periods",1,999,3);  
R:=2/(N+1); 
If(Cum(1)=1,C,PREV*(1-R)+C*R);

{Wilders Smoothing}
N:=Input("Periods",1,99,15);  
R:=1/N;
If(Cum(1)<=N,Mov(C,N,S),PREV*(1-R)+C*R);


Regards

Roy
www.metastocktips.co.nz


----- Original Message ----- 
From: mano.rm 
To: equismetastock@xxxxxxxxxxxxxxx 
Sent: Sunday, March 26, 2006 9:30 PM
Subject: [EquisMetaStock Group] EMA indicator code


Hi,

I'm reinventing the wheel trying to develop an EMA indicator identical
to that used in Metastock.

Now the indicator code below almost works, but when compared to a
default Mov(P,Periods,E) plot it does not plot/calc exactly the same
at the start of the data array but given about 3*Period the values end
up identical. For all intents and purposes with enough data I'll get
the same results, but I would like to get the calc perfect.

So far I have the developed the ffg:

{Metastock exponential moving average}
Periods := Input("Time Periods",1,1000,3);
Constant:= 2/(Periods+1);
MEMA := If(Cum(1) = Periods,
(Ref(Mov(P,Periods-1,S),-1)*Constant)+Constant*P, If(Cum(1) = Periods
+1,(P*Constant)+Mov(P,Periods,S)*(1-Constant), PREV + Constant * (P -
PREV)));
MEMA;

My problem appears to be with what code to put after the first If, or
if that bit is correct then how to feed the value from there into the
2nd If statement or how to do everything differently and simply
achieve the Metastock identical end result.

The method behind this madness is once I have EMA worked out then to
simply change

Constant:=1/Periods;

This I hope will give me the formula Metastock uses for Wilders
smoothing, i.e. its function Wilders()

Is seems to but obviously because of the error at the beginning of my
code it takes some periods to plot correctly

Why all this you may ask. Nothing to do with Metastock except for my
own interest in how to do it there. Omnitrader Pro doesn't have a
Wilder's smoothing indicator so once I can do all the maths correctly
in Metastock I'm hopeful I can programme it elsewhere too. Of course I
don't have a Cum() or PREV function there either but with a For Next
or Do Until or Do While loop in OT/VB code I'm hoping to achieve this
functionality. If none of that works then its return to sender and
demand my $ back.

Can anyone suggest some code corrections/pointers.

Thanks









----------------------------------------------------------------------------
----
YAHOO! GROUPS LINKS 

  a..  Visit your group "equismetastock" on the web.
    
  b..  To unsubscribe from this group, send an email to:
   equismetastock-unsubscribe@xxxxxxxxxxxxxxx
    
  c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


----------------------------------------------------------------------------
----



[Non-text portions of this message have been removed]




SPONSORED LINKS 


Business
<http://groups.yahoo.com/gads?t=ms&k=Business+finance+course&w1=Business+fin
ance+course&w2=Business+to+business+finance&w3=Small+business+finance&w4=Bus
iness+finance+consultant&w5=Business+finance+magazine&w6=Business+finance+sc
hools&c=6&s=185&.sig=I8jDsORmsaYn0BeqghcJ2w>  finance course 

Business
<http://groups.yahoo.com/gads?t=ms&k=Business+to+business+finance&w1=Busines
s+finance+course&w2=Business+to+business+finance&w3=Small+business+finance&w
4=Business+finance+consultant&w5=Business+finance+magazine&w6=Business+finan
ce+schools&c=6&s=185&.sig=fCzze7cxm1K7TVKkzAaOrA>  to business finance 

Small
<http://groups.yahoo.com/gads?t=ms&k=Small+business+finance&w1=Business+fina
nce+course&w2=Business+to+business+finance&w3=Small+business+finance&w4=Busi
ness+finance+consultant&w5=Business+finance+magazine&w6=Business+finance+sch
ools&c=6&s=185&.sig=v9sWAno7Kz4WuL8Tadcdhw>  business finance 


Business
<http://groups.yahoo.com/gads?t=ms&k=Business+finance+consultant&w1=Business
+finance+course&w2=Business+to+business+finance&w3=Small+business+finance&w4
=Business+finance+consultant&w5=Business+finance+magazine&w6=Business+financ
e+schools&c=6&s=185&.sig=d1xwT3WL0E6XBf6cAV5BXA>  finance consultant 

Business
<http://groups.yahoo.com/gads?t=ms&k=Business+finance+magazine&w1=Business+f
inance+course&w2=Business+to+business+finance&w3=Small+business+finance&w4=B
usiness+finance+consultant&w5=Business+finance+magazine&w6=Business+finance+
schools&c=6&s=185&.sig=qphRINaNuVm_6bwoQxgUmg>  finance magazine 

Business
<http://groups.yahoo.com/gads?t=ms&k=Business+finance+schools&w1=Business+fi
nance+course&w2=Business+to+business+finance&w3=Small+business+finance&w4=Bu
siness+finance+consultant&w5=Business+finance+magazine&w6=Business+finance+s
chools&c=6&s=185&.sig=1RfnhYZpV99RKWRZzSH4gA>  finance schools 

 

  _____  

YAHOO! GROUPS LINKS 

 

*	 Visit your group "equismetastock
<http://groups.yahoo.com/group/equismetastock> " on the web.
  
*	 To unsubscribe from this group, send an email to:
 equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<mailto:equismetastock-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
  
*	 Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/>  Terms of Service. 

 

  _____  



[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/