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:
Color Price Bars with MACD Histogram Changes
Author/Uploader:
MTR Investors Group - support [at] mtrig.com
Date/Time added:
2009-06-26 22:17:20
Origin:
Dr. Alexander Elder
Keywords:
Triple Screen, Elder
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:
Use on weekly charts to determine Trend Changes. If the Weekly Bars are Green check the daily bars for LONG entries, if the Weekly Bars on Red check the daily for SHORT entires.
Formula:
/*--------------------------------------------------------------------
MTR Investors Group - www.MTRIG.com
Color price bars with MACD Histogram Bars changes. Use on weekly chart
to determine market trend. See Elder "Come into my trading room"
----------------------------------------------------------------------*/
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
TimeFrameSet( inDaily) ;
//MACD
r1 = Param( "Impulse Fast avg", 12, 2, 200, 1 );
r2 = Param( "Impulse Slow avg", 26, 2, 200, 1 );
r3 = Param( "Impulse Signal avg", 9, 2, 200, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hist = ml-sl;
MACUP = Hist > Ref(Hist,-1);
MACDN = Hist < Ref(Hist,-1);
BarColor = IIf(MACUP,colorGreen,IIf(MACDN,colorRed,colorBlue));
Plot( C, "Close", BarColor, styleNoTitle | ParamStyle("Style") |
GetPriceStyle() );