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

Re: [amibroker] MACD Histogram



PureBytes Links

Trading Reference Links

Hi protraderinc
I made a few additions to your afl on the indicator side (attached).
Thought you might like to see it, bottom panel.
Roger

// from protraderinc   protraderinc@xxxxxxxxx
//MACD above Zero Line

//RSI Above 30

//This system is base on trend trading. Buying on pullback when the market continue its up trend.

r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2),
ParamColor("MACD color", colorAqua ), ParamStyle("MACD style",
styleThick) );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
ParamColor("Signal color", colorRed ), ParamStyle("Signal style",
styleThick) );
//Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style",styleHistogram | styleNoLabel, maskHistogram ) );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
Hist= m1-s1;
Histprev=Ref(Hist,-1);

Color = IIf(Hist>Histprev,ParamColor("MACD-H Up Color", colorGreen),
IIf(hist<histprev,ParamColor("MACD-H Down
Color",colorCustom16),colorRed));

Plot(m1-s1,"MACD Histogram",Color,styleHistogram|styleNoTitle|styleThick);

SetChartBkGradientFill( ParamColor("Backgroud Top Color",
colorRed),ParamColor("Background Bottom Color", colorDarkGrey));

//This indicator shows the value of tomorrow's Closing Price
//in order for the slope of the MACD Histogram to change Direction.
//(ie. changing from a positive slope to a negative slope OR changing
//from a negative slope to a positive slope)
GraphXSpace = 8;

f1 = ((r3+1)*M1-2*S1)/(r3-1);
f2 = EMA(C,r1)*(r1-1)/(r1+1);
f3 = EMA(C,r2)*(r2-1)/(r2+1);
f4 = 2/(r1+1) - 2/(r2+1);

dcv = (f1-f2+f3)/ f4;

Title = Name() + " - " + FullName() + " - " + Date() + " - Close
= " +
WriteVal(C,0.3) + " - DCV = " + WriteVal(dcv,0.3);

Up = Cross(ml, sl);
Dn = Cross(sl, ml);
PlotShapes(Up*shapeUpArrow,colorGreen);
PlotShapes(Dn*shapeDownArrow,colorRed);

Plot(C,"",colorYellow,64 | styleOwnScale);