Thursday, February 12, 2009

Stockcharts.com sharp price chart on Amibroker

4 candle types in stockcharts.com's sharp chart.

solid BLACK:today's close > yesterday's close but today's close < today's open.
solid RED:today's close < yesterday's close.
hollow BLACK:today's close > yesterday's close.
hollow RED:today's close < yesterday's close but today's close > today's open.

coding in amibroker will be followed:

_SECTION_BEGIN("StockChart - Price");

upbar1 = C > Ref (C, -1);
upbar2 = O < Ref (C, -1) AND C < Ref (C,-1) AND C > O;
downbar1 = C < Ref (C, -1);
downbar2 = O > Ref (C, -1) AND C > Ref (C,-1) AND C < O;

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", IIf (upbar2, colorWhite, IIf (downbar2, colorBlack, IIf(upbar1, colorGreen, colorRed ))), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


and then change the software option in TOOLS-->Preferences-->Charting-->Candlesticks, select "Use one color for entire candle and solid body for UP candle."



solid white represents the hollow red in stockcharts style.

No comments: