PureBytes Links
Trading Reference Links
|
BB usually use 2 SD (nothing magic about that) which contain 95% of
prices.You can use fractional SD's to contain whatever % you want. From
reading this thread, It seems you want to contain 85% of price bars, not
prices. You cannot do that with simple % above and below bands unless
you make the % so large that the envelope is useless.
Initially I thought it would be very difficult but you can do something
with MA's that looks similar to BB.
It took me quite some time to figure it out because I am not very good
with the AFL but in hindsight, it turned out to be simpler than I
thought it would be.
The formula is below.
Caveat: There are degenerate cases that won't converge to within the 2%
criteria that I used. I use a 'binary search' algorithm so it usually
converges within 5 iterations of the loop. You can set up a loop counter
and terminate the loop after 8 iterations to avoid problems with the
degenerate cases. That will get you to within .5% of the high-low range
to the optimum solution.
Observations: You can reduce both the ExternalBarPct and the ConvergePct
to get a better envelop fit. Also, if you shift the Middle MA back 1/2
its period (always use an odd number for the period and shift it back
(period + 1)/2) before doing the calculations, the envelope width will
be much narrower and track the price extremes more closely.
Bill
---
LookBkPd = 100 ;
AvgPd = 21 ;
ExternalBarPct = 15 ;
ConvergePct = 2 ;
Middle = MA( C,AvgPd ) ;
Rng = HHV( H,LookBkPd ) - LLV( L,LookBkPd ) ;
X = Rng ;
deltaX = X/2 ;
do
{
Over = H > Middle + X ;
Under = L < Middle - X ;
OuterPct = 100*( Sum( Over, LookBkPd ) + Sum( Under, LookBkPd )
)/LookBkPd ;
OP = LastValue(OuterPct) ;
X=X+sign( OP - ExternalBarPct )*deltaX ;
deltaX = deltaX/2 ;
}while ( abs( OP - ExternalBarPct ) > ConvergePct ) ;
Plot( Middle, "MA", colorRed, styleLine|styleNoTitle ) ;
Plot( Middle+X, "MA", colorBlue, styleLine|styleNoTitle ) ;
Plot( Middle-X, "MA", colorBlue, styleLine|styleNoTitle ) ;
---
niceguyeddy5 wrote:
> Bill....correct me if I'm wrong....I was just hoping for "percent
> above and below" bands that work in conjuction with the moving
> average....as opposed to standard deviation bands.
>
> b/r,
> ed s.
>
> --- In amibroker@xxxxxxxxxxxxxxx, bilbod <bilbod@xxxx> wrote:
> > That's what Bollinger Bands are for.
> >
> > Bill
> >
> > niceguyeddy5 wrote:
> >
> > > Hello.....
> > >
> > > Is there an indicator out there that can automatically adjust the
> > > width of moving average channels to fit a givnen amount of data?
> > >
> > > That is.....the moving average channels are great....but it's
> kind of
> > > a pain to use trial and error to re adjust them to contain, say,
> 85%
> > > of the data for each new chart I load...
> > >
> > > Thanks...
> > >
> > > Ed S.
> > >
> > >
> > >
> > >
> > >
> > > Please note that this group is for discussion between users only.
> > >
> > > To get support from AmiBroker please send an e-mail directly to
> > > SUPPORT {at} amibroker.com
> > >
> > > For other support material please check also:
> > > http://www.amibroker.com/support.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
> > > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?
> subject=Unsubscribe>
> > >
> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.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
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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/
|