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

Re: [amibroker] Re: Standard Error bands - Indicator



PureBytes Links

Trading Reference Links

Hello,

Yes that's true. Actually "Standard Error" parameter defines number of periods for BOTH standard error and linear reg. (as in
built-in BBandTop and BBandBot). "Periods" is unused (left over the William's original code he sent me for checking).

The most important part is  SteBand function

function SteBand( array, periods, upper )
{
  Lr = LinearReg( array, periods );
  se = StdErr( array, periods );
   return LR + IIf( upper, 1, -1 ) * 2 * se;
}

You can for your convenience use it to write functions that
are similar to BBandTop, BBandBot:

function SteBandTop( array, periods )
{
  return SteBand( array, periods, True );
}

function SteBandBot( array, periods )
{
  return SteBand( array, periods, False );
}

///
Now for your convenience the entire formula with extra parameter removed:

Var= Param("STD Err Band Periods", 18, 1, 100, 1);

function SteBand( array, periods, upper )
{
  Lr = LinearReg( array, periods );
  se = StdErr( array, periods );
  return LR + IIf( upper, 1, -1 ) * 2 * se;
}

upperstderrband = SteBand( C, Var, True );
lowerstderrband = SteBand( C, Var, False );
midstderrband = (upperstderrband + lowerstderrband )/2;

Plot(upperstderrband ,"upperstderrband ",colorGreen,4);
Plot(Close,"Close",colorBlack,styleCandle);
Plot(lowerstderrband ,"lowerstderrband ",colorRed,4);
Plot(midstderrband ,"midstderrband ",colorBlack ,styleLine);
GraphXSpace = 5;

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "William Peters" <williampeters@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, December 21, 2003 12:19 AM
Subject: [amibroker] Re: Standard Error bands - Indicator


> Dave,
>
> No it's not just you, i'll have to find out what the problem is. Or if TJ is monitoring this he might be able to give an answer to
the problem. I'm sure its an easy modification but not for me :)
>
> Regards,
> William Peters
> www.amitools.com
>
>
>
> -----Original Message-----
> From: dcrotty2003 [mailto:dcrotty2003@xxxxxxxxxxxx]
> Sent: Saturday December 20, 2003 5:52 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Standard Error bands - Indicator
>
>
> Hi William,
>
> Maybe it's just me, but the Param:
>
> Periods= Param("Periods", 3, 1, 100, 1);
>
> ...doesn't seem to work.
>
> Dave.
>
> --- In amibroker@xxxxxxxxxxxxxxx, "William Peters"
> <williampeters@xxxx> wrote:
> > Hi,
> >
> > Just sharing some code that I originally found on this forum
> (somewhere) and
> > was subsequently found to be wrong. Tomasz has made the
> corrections so here
> > it is. I've also added it to the AFL library on the AmiBroker web site.
> >
> > /* Standard Error Bands */
> > Var= Param("Standard Error", 18, 1, 100, 1);
> > Periods= Param("Periods", 3, 1, 100, 1);
> >
> > function SteBand( array, periods, upper )
> > {
> >   Lr = LinearReg( array, periods );
> >   se = StdErr( array, periods );
> >   return LR + IIf( upper, 1, -1 ) * 2 * se;
> > }
> >
> > upperstderrband = SteBand( C, Var, True );
> > lowerstderrband = SteBand( C, Var, False );
> > midstderrband = (upperstderrband + lowerstderrband )/2;
> >
> > Plot(upperstderrband ,"upperstderrband ",colorGreen,4);
> > Plot(Close,"Close",colorBlack,styleCandle);
> > Plot(lowerstderrband ,"lowerstderrband ",colorRed,4);
> > Plot(midstderrband ,"midstderrband ",colorBlack ,styleLine);
> > GraphXSpace = 3;
> > Regards,
> > William Peters
> > www.amitools.com
>
>
> 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/
>
>
>
>
> 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/
>
>
>


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/