PureBytes Links
Trading Reference Links
|
|
Steve, Tried your BB code and got an error #29 "Lowband being used without being initialized". Marshall
-------Original Message-------
Date: 05/29/05 22:36:39
Subject: Re: [amibroker] Moving Average Channels?
Hi again,
As I read my own e-mail, I see that the code could be better. Here is an improved version with a few changes:
Steve ------------------------------------------- MovAvgPds = 13; LookbackPds = 63; Step = 0.25 // increment bands by this much each step WantInChan = 85 // want 85% of bars to be inside channel
MovAvg = MA( Close, MovAvgPds ); KeepLooping = True; For( Incr = Step; Incr < 100 AND KeepLooping; Incr = Incr + 0.25 ) { UpperBand = MovAvg + Incr; LowerBand = MovAvg - Incr; InChan = High < UpperBand AND Low > LowerBand TotalInChan = Sum (InChan, LookbackPds ); PctInChan = TotalInChan / LookbackPds * 100; If( PctInChan >= WantInChan ) KeepLooping = False; }
Plot( Close, "Close", colorBlack, styleCandle ); Plot( UpperBand, "Upper Band", colorBlue, styleLine ); Plot( LowerBand, "Lower Band", colorBlue, styleLine );
----- Original Message ----- From: "Steve Dugas" <sjdugas@xxxxxxxxxxx> To: <amibroker@xxxxxxxxxxxxxxx> Sent: Sunday, May 29, 2005 10:00 PM Subject: Re: [amibroker] Moving Average Channels?
> How about something like this? I haven't tested it, just typed it in here. > > Steve > ------------------------------------------------- > > MovAvgPds = 13; > LookbackPds = 63; > WantInChan = 85 // want 85% of Closes to be inside channel > > MovAvg = MA( Close, MovAvgPds ); > UpperBand = LowerBand = MovAvg; > KeepLooping = True; > // adjust Incr as desired > For( Incr = 0.25; Incr < 10 AND KeepLooping; Incr = Incr + 0.25 ) > { > UpperBand = UpperBand + Incr; > LowerBand = LowerBand - Incr; > InChan = Close < UpperBand AND Close > LowerBand > TotalInChan = Sum (InChan, LookbackPds ); > PctInChan = TotalInChan / LookbackPds * 100; > If( PctInChan >= WantInChan ) > KeepLooping = False; > } > > Plot( Close, "Close", colorBlack, styleCandle ); > Plot( UpperBand, "Upper Band", colorBlue, styleLine ); > Plot( LowerBand, "Lower Band", colorBlue, styleLine ); > > > ----- Original Message ----- > From: "niceguyeddy5" <niceguyeddy5@xxxxxxxxxxxxx> > To: <amibroker@xxxxxxxxxxxxxxx> > Sent: Sunday, May 29, 2005 5:44 PM > Subject: [amibroker] Moving Average Channels? > > >> 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 >> >> >> >> >> >> >> > > > > > 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 > > > > > > >
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
| |
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
|
|