New in Wolfram
Mathematica
8: Financial Visualization
◄
previous
|
next
►
Graphics & Visualization
Use Wrappers to Annotate Events
Use data wrappers to add labels directly to the data corresponding to an event.
In[1]:=
X
data = FinancialData["EBAY", "OHLC", {{2010, 5, 1}, {2010, 5, 31}}]; sty[label_] := Style[label, 14]; ndata = Cases[data, {date_, {o_, h_, l_, c_}} :> Which[ (*Doji*)Abs[(c - o)]/o < 0.005, Labeled[{date, {o, h, l, c}}, Column[sty /@ {"Doji", "\[DownArrow]"}, Center], Above], (*Long wave*)(h - l)/l > 0.1, Labeled[{date, {o, h, l, c}}, Column[sty /@ {"Long wave", "\[DownArrow]"}, Center], Above], (*Hammer*)(h - c)/c < 0.005 && 0 < (c - o)/o < 0.01, Labeled[{date, {o, h, l, c}}, Column[sty /@ {"Hammer", "\[DownArrow]"}, Center], Above], (*Bullish*)(c - o)/o > 0.05, Labeled[{date, {o, h, l, c}}, Column[sty /@ {"Bullish"}, Center], Center], True, {date, {o, h, l, c}}]]; CandlestickChart[ndata, ImageSize -> 500, BaseStyle -> {FontFamily -> "Helvetica"}, ChartElementFunction -> "FadingCandlestick", Frame -> {Left, Right, Top}, FrameTicks -> {{True, True}, {False, False}}, Axes -> {True, False}, PlotRangePadding -> {None, Automatic}]
Out[1]=