_SECTION_BEGIN("KH_PriceChart");
//-- Author : KelvinHand
//http://www.wisestocktrader.com/indicators/3336-integrated-price-chart
bgTop = ParamColor("BgTop", colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
//SetChartBkGradientFill( bgTop ,bgBot, colorLightGrey);
pStyle = ParamList("Price Style", "Candle|Solid Candle|Bar|Line|Heikin-Ashi");
cBull = ParamColor("Price Bull", colorLime);
CBear = ParamColor("Price Bear", colorRed);
cLine = ParamColor("Price Line", colorWhite);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}}- {{INTERVAL}} {{DATE}} O= %g, H= %g, L= %g, C= %g (%.1f%%) V= " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
ThisStyle = styleCandle;
ThisTitle = "";
_O=O; _C=C; _H=H; _L=L;
ThisColor = IIf( _C>_O, cBull, IIf(_C<_O, CBear, CLine));
switch (pStyle )
{
case "Solid Candle":
SetBarFillColor( ThisColor );
break;
case "Bar":
ThisStyle = styleBar;
break;
case "Line":
ThisStyle = styleLine;
ThisColor = cLine;
break;
case "Heikin-Ashi":
_C = (O+H+L+C)/4;
_O = AMA( Ref( _C, -1 ), 0.5 );
_H = Max( H, Max( _C, _O ) );
_L = Min( L, Min( _C, _O ) );
ThisColor = IIf(_C >= _O,CBull, CBear);
SetBarFillColor( ThisColor );
ThisColor = IIf(_C >= _O,cLine, cLine);
ThisTitle = "Heikin-Ashi";
break;
default:
SetBarFillColor( ThisColor );
ThisColor = cLine;
break;
}
PlotOHLC( _O, _H, _L, _C, ThisTitle, ThisColor, ThisStyle);
GraphXSpace = 5;
_SECTION_END();
_SECTION_BEGIN("Money-Line");
//-- Am I Smart-- ???
//-- Simulate MT4 Platform
MA_Mode = ParamList("Method:", "Simple,Exponential,Smooth,Linear Weighted",2);
MA_Price = ParamList("Applied To:", "Close,Open,High,Low,Median Price,Typical Price,Weighted Price");
MA_Period = Param("Period:", 88, 1, 9999 );
MA_Shift = Param("Shift", 0, -10, 10 );
cColor = ParamColor("Color", colorYellow);
iStyle = ParamStyle("Style", styleNoLabel, maskAll);
iWidth = Param("Width", 3, 1,100);
ZOrder = Param("ZOrder",1, -10, 10);
switch (MA_Price)
{
case "Open" : p = Open; break;
case "High" : p = High; break;
case "Low" : p = Low; break;
case "Median Price" : p = (H+L)/2; break;
case "Typical Price" : p = (H+L+C)/3; break;
case "Weigthed Price" : p = (H+L+C+C)/4; break;
default: p = Close; break;
}
switch (MA_Mode)
{
case "Exponential": iMA = EMA( P, MA_Period ); break;
case "Linear Weighted": iMA = WMA( P, MA_Period ); break;
case "Smooth": iMA = Wilders( P, MA_Period ); break;
default: iMA = MA( P, MA_Period ); break;
}
ShortName = _Default_name();
if (MA_Shift !=0)
ShortName = ShortName + "x"+MA_Shift;
Plot( iMA, ShortName, cColor, iStyle, Null, Null, MA_Shift, ZOrder , iWidth );
_SECTION_END();
_SECTION_BEGIN("Forecaster");
//-- Am I Smart-- ???
// Modified from https://www.amibroker.com/library/detail.php?id=635
uptrend=Signal()<MACD();
downtrend=Signal()>MACD();
Plot( 2, /* defines the height of the ribbon in percent of pane width
*/"",
IIf( uptrend, colorLime, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();