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

RE: [amibroker] Re: Quotes Editor in AB



PureBytes Links

Trading Reference Links

This is close, at least there's a plot and very similar to the 
regular MA though not completely.

Btw it is not an exponential but a simple mov.avg. i was trying to 
define. The "formula" sure is o.k., the problem is in the coding (in 
mine).

At first sight I don't get why it is necessary to use the subscript 
[], need some time to digest.

Should you run into the exact match please do post it. Appreciate 
your help.

treliff

--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> This may be what you are seeking? Not an exact match for the EMA 
but a
> starting point ?
> 
> function MN(n)
>  {
>  // local result;
>  result = C ;
>  for (i=n-1;i<BarCount;i++)
>  {
>  result[i] = (n-1)/n*result[i-1] + (1/n)*C[i-n+1] ;
>  }  
>  return result;
>  }
>  Plot(MN(2),"MN(2)", colorBlue); 
> 
> Plot(EMA(C,2),"MA(2)",colorRed);
> 
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
> 
> -----Original Message-----
> From: treliff [mailto:treliff@x...] 
> Sent: Friday, March 19, 2004 8:36 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Looping stuff driving me nuts, please 
help...
> 
> perhaps i should add:
> 
> I added the MA(C,2) as a visual check: if the MN code is correct 
> than 
> MN(2) = MA(C,2) the plots overlap
> and also
> MN(3) = MA(C,3)
> MN(4) = MA(C,4)
> etc.
> 
> treliff
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "treliff" <treliff@xxxx> wrote:
> > Graham, would you mind to give me the full code including the 
> > subscript operator as you use it?
> > 
> > Herman, my plot shows the blue line completely different from 
the 
> > red. If the code is correct then they should overlap.
> > 
> > treliff
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> 
wrote:
> > > Should it be ?
> > > 
> > > Result[i] = ((i-1)/i)*result[i-1] + (1/i)*Ref(C[i],-(i-1)) ;
> > > 
> > > Cheers,
> > > Graham
> > > http://e-wire.net.au/~eb_kavan/
> > > 
> > > -----Original Message-----
> > > From: treliff [mailto:treliff@x...] 
> > > Sent: Friday, March 19, 2004 7:30 AM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Looping stuff driving me nuts, please 
> help...
> > > 
> > > Looping stuff.... I've had some guidance from the forum and TJ
> > > and 
> > > thought I got it, but every new loop I take on gets stuck.
> > > 
> > > I went back to the basics, as an exercise trying to write a 
> > function 
> > > loop for a simple moving average:
> > > 
> > > function MN(n)
> > > {
> > > // local result;
> > > result = C ;
> > > for (i=2;i<BarCount;i++)
> > > {
> > > result = ((i-1)/i)*result + (1/i)*Ref(C,-(i-1)) ;
> > > }
> > > return result;
> > > }
> > > Plot(MN(2),"MN(2)", colorBlue);
> > > Plot(MA(C,2),"MA(2)",colorRed);
> > > 
> > > Just doesn't work, my MN(n) is empty for every n. What's
> > > wrong?
> > > Thanks for your patience with me.
> > > 
> > > treliff 
> > > 
> > > 
> > > 
> > > 
> > > Send BUG REPORTS to bugs@xxxx
> > > Send SUGGESTIONS to suggest@xxxx
> > > -----------------------------------------
> > > Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx 
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > --------------------------------------------
> > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > Yahoo! Groups Links
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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

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