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

[amibroker] Re: Average Range



PureBytes Links

Trading Reference Links

Don't worry about being an Newb - I'm only 5 seconds ahead of you - 
ask away - you might not always get an answer if no one is around.

Apologies - there was an error in my code.

Midpoint = (H+L)/2; so my answer would plot as a constant 2.

Try this:

//To plot BarRange% as an indicator
//Change Periods as required or use Param function


Periods = 100;
Range = H-L;
MidPoint = (H+L)/2;
BarRangePercent = Range/MidPoint * 100;
AveBarRangePercent = MA(BarRangePercent,Periods);
//Plot(AveBarRangePercent, "AveBarRangePercent", colorBlue,1);

//To Plot BarRange% as a band

AveUpperBarRangePercent = AveBarRangePercent/2;
BarRangeUpperBand = Midpoint * (1 + AveUpperBarRangePercent/100);
Plot(BarRangeUpperBand,"BarRangeUpperBand",colorBlue,1);

If you slide it onto a chart it will plot the upper band - I left the 
lower band for you to work out yourself (1-etc).

If you want to plot it as an indicator then comment out the lower 
plot and uncomment the upper.

Good luck with AB and your trading.

brian_z



--- In amibroker@xxxxxxxxxxxxxxx, "longarm61" <norm1@xxx> wrote:
>
> Thank you very much, Brian.  Percentage is exactly what I wanted 
> (didn't want to ask for more than I absolutely needed, though).  
> Sorry for being such a newb, but how would I plot this formula?
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@> wrote:
> >
> > Actually, if I was going standardise BarRange I would use the 
> MidPoint
> > 
> > Periods = x;
> > MidPoint = (H-L)/2;
> > BarRangePercent = (H-L)/Midpoint *100;
> > AveBarRangePercent = MA(BarRangePercent,x);
> > 
> > 
> > brian_z
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@> 
wrote:
> > >
> > > Hello Grant,
> > > 
> > > Something along the lines of?
> > > 
> > > Periods = x;
> > > AveBarRange = Sum(H-L,x)/x;
> > > 
> > > You can standardise (or normalise) by converting to %:
> > > 
> > > BarRangePercent = (H-L)/L * 100;
> > > Periods = x;
> > > AveBarRange = Sum(BarRangePercent,x)/x;
> > > 
> > > I always normalise in situations like that.
> > > 
> ********************************************************************
> > > SUM
> > > - sum data over specified number of bars Moving averages, 
> summation
> > > 
> > >  
> > > 
> > > SYNTAX  sum( ARRAY, periods )  
> > > RETURNS ARRAY  
> > > FUNCTION  Calculates a cumulative sum of the ARRAY for the 
> > specified 
> > > number of lookback periods (including today).  
> > > EXAMPLE The formula "sum( CLOSE, 14 )" returns the sum of the 
> > > preceding 14 closing prices. A 14-period simple moving average 
> > could 
> > > be written "sum(C,14) / 14." 
> > > 
> > 
> 
*********************************************************************
> > > 
> > > You can use the Param function for periods if you want to 
change 
> > the 
> > > periods from with the context menu on a chart.
> > > 
> > > PARAM
> > > - add user user-definable numeric parameter Exploration / 
> Indicators
> > > (AFL 2.3)
> > >  
> > > 
> > > SYNTAX  Param( ''name'', defaultval, min, max, step, sincr = 
0 )  
> > > RETURNS NUMBER  
> > > FUNCTION  Adds a new user-definable parameter, which will be 
> > > accessible via Parameters dialog :
> > > right click over chart pane and select "Parameters" or press 
> Ctrl+R 
> > > allows to change chart parameters - changes are reflected 
> > > immediatelly. 
> > > 
> > > "name" - defines parameter name that will be displayed in the 
> > > parameters dialog 
> > > defaultval - defines default value of the parameter 
> > > min, max - define minimum and maximum values of the parameter 
> > > step - defines minimum increase of the parameter via slider in 
> the 
> > > Parameters dialog 
> > > sincr - automatic section increment value (used by drag-drop 
> > > interface to increase default values for parameters) 
> > > WARNING: default/min/max/step parameters have to be CONSTANT 
> > numbers. 
> > > This is because these values are cached and are not re-read 
> during 
> > > subsequent formula evaluations.
> > > 
> > > 
> > > brian_z
> > >  
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "longarm61" <norm1@> wrote:
> > > >
> > > > I would simply like an indicator that shows the average 
range, 
> > from 
> > > > high to low, of x number of bars.  Just the bars only.  ATR 
> takes 
> > > > into account the previous close, which I don't want.
> > > > 
> > > > Anyone have or can point me to a formula for this?
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Grant
> > > >
> > >
> >
>




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 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/