PureBytes Links
Trading Reference Links
|
Hi Howard, thanks for your reply.
I am looking at calculating an exponential moving average, but would
like to have initial values as well (instead of null values).
For example:
If I do an EMA(Close, 20), I will get a chart of the 20-day EMA of
close with null values for the first 20 bars.
So what I am trying to do is create my own EMA function via looping
(similar to pg.114 of the Amibroker User Guide), where the running
median would be calculated for (i + 1) < Period. I can do it with an
initial simple running average calculation (since I can incorporate
that in the loop for (i + 1) < Period ), but would prefer to use the
median in case there are initial spikes.
Another question loosely related to this:
When I incorporate a manual bar count via looping (see code below) and
then click on a bar on the chart, the value changes when I scroll left
or right or zoom in or out. Why is this?
CT[0] = 1;
for( i = 1; i < BarCount; i++ )
{
CT[i] = 1 + CT[i-1];
}
Plot( CT, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
Thanks.
--- In amibroker@xxxxxxxxxxxxxxx, "Howard B" <howardbandy@xxx> wrote:
>
> Hi Searnp --
>
> The User's Guide states:
> AFL Function Reference - MEDIAN *MEDIAN
> *- calculate median (middle element)
>
> *Statistical functions
> *(AFL 2.5)
>
> *SYNTAX* *Median( array, period ) * *RETURNS* ARRAY *FUNCTION*
The Median
> function - finds median (middle element) value of the *array* over
> *period*elements.
> *EXAMPLE* // list only symbols which volume is greater than
> // median Volume from past 50 days
> *Filter* = *Volume* > Median( *Volume*, 50 );
> AddColumn( *V*, "Volume" );
> Period must be a scalar -- a constant. When you run this code:
>
> RM = Median(Close, BarIndex() + 1);
>
> The entire Close array is passed to the Median function at one time.
The
> value of BarIndex changes with each element of the Close array.
Looked at
> simplistically, the afl processor does not know which value of
BarIndex to
> use, so it coughs.
>
> You will have to write your own function using looping code.
>
> Before you start, are you certain that you want the median value of an
> expanding list of data values? Today's value will depend on how
much data
> was loaded, which is generally not a good programming or systems
idea. Will
> Median(C,50), or some variation, give you what you need?
>
> Thanks,
> Howard
>
>
>
> On Mon, Nov 3, 2008 at 11:26 AM, searnp <searnp@xxx> wrote:
>
> > I am trying to calculate a running median that starts at bar 0.
> >
> > Code:
> >
> > RM = Median(Close, BarIndex() + 1);
> >
> >
> > Then I get the following error message:
> >
> > Error 5. Argument #2 has incorrect type (the function expects
different
> > argument type here)
> >
> >
> > I am using "Barindex() + 1" to get a running count at each bar to
be used
> > in the median's lookback period. Is there a way to implement this?
> >
> > Thanks.
> >
> >
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|