This is read-only version of AFL library entry. Ability to add user formulas
and comment is only available from members-only area.
Details:
Formula name:
Average Price Crossover
Author/Uploader:
Bobby Kular - stocks_bobby [at] yahoo.com
Date/Time added:
2007-04-21 03:40:00
Origin:
Keywords:
Level:
basic
Flags:
indicator
DISCLAIMER: Most formulas present in AFL on-line library are submitted
by the users and are provided here on an "as is" and "as available" basis.
AmiBroker.com
makes no representations or warranties of any kind to the contents or the operation
of material presented here. We do not maintain nor provide technical support
for 3rd party formulas. Description:
This AFL consists of all good averages known to me. It is an indicator in which price becomes green when price crosses above average and vica versa.
The name of average also tells the time period setting on 60 min time frame.
Formula:
//Modified by Bobby Kular email: bobby.kular@yahoo.com
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
priceTitle=StrFormat("---- {{NAME}} ---------- {{VALUES}}");
Title ="Averages" + priceTitle;
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g
(%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
SetChartBkColor(ParamColor("Outer panel color ",colorBlack)); // color of outer
border
SetChartBkGradientFill( ParamColor("Inner panel color upper
half",colorBlack),ParamColor("Inner panel color lower half",colorBlack)); //
color of inner panel
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("Average");
P = ParamField("Field");
Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear
Regression-45,Exponential,Double Exponential,Tripple
Exponential,Wilders,Simple");
Periods = Param("Periods", 9, 2, 100 );
Displacement = Param("Displacement", 1, -50, 50 );
m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods );
if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods),
Periods);
if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4
);
if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods );
if( Type == "Exponential" ) m = EMA( P, Periods );
if( Type == "Double Exponential" ) m = DEMA( P, Periods );
if( Type == "Tripple Exponential" ) m = TEMA( P, Periods );
if( Type == "Wilders" ) m = Wilders( P, Periods );
if( Type == "Simple" ) m = MA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", colorWhite), styleThick, 0, 0,
Displacement );
//Plot Price
barcolor = IIf(C > m, ParamColor("Up Color",colorBrightGreen), IIf(C
==m,colorRed, ParamColor("Dn Color",colorRed)));
Plot( C, "Close", barcolor, ParamStyle("Style",styleThick+styleNoLabel) |
GetPriceStyle());
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
_SECTION_BEGIN("Price");
Plot( C, "Close", ParamColor("Color", colorLightOrange ),
styleNoLine|styleNoRescale );
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hi, bobby
nice efforts...
thanks for sharing.
but couldnt understand few things, like when i move the cursor the color of the "CLOSE" changes to red or green at one candle but if i move the cursor back over the same candle it doesnt change immideately. it changes after few candles. can u explain the use of this formula.
hello some error shows at SetChartBkGradientFill( ParamColor("Inner panel color upper half",colorBlack),ParamColor("Inner panel color lower half",colorBlack)); // color of inner panel
_SECTION_END();
cursser blinking after SetChartBkGradientFill......? please cheq then send me a alert so i download it in my ami broker and also attached buy sell automatic analise thanks dhiraj