MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: financial chart with volumes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93810] Re: financial chart with volumes
  • From: Andreas <aagas at ix.netcom.com>
  • Date: Wed, 26 Nov 2008 05:14:43 -0500 (EST)

I worked out a simple candlestick chart:

dateOffset = 100;
datesStartEnd = {DatePlus[DateList[], -dateOffset], DateList[]};
instrument = "IBM";
candleColor = Black

Show[
 {
  DateListPlot[
   {FinancialData[instrument, "Low", datesStartEnd],
    FinancialData[instrument, "High", datesStartEnd]},
   Filling -> {1 -> {2}}, FillingStyle -> Directive[Gray, Thin], 
   PlotMarkers -> {"", ""}
   ],
  DateListPlot[
   {FinancialData[instrument, "Open", datesStartEnd],
    FinancialData[instrument, "Close", datesStartEnd]},
   Filling -> {1 -> {2}}, 
   FillingStyle -> 
    Directive[candleColor, Thickness[.0075*100/dateOffset], 
     Opacity[1]], PlotMarkers -> {"", ""}
   ]
  }, ImageSize -> 400, PlotLabel -> instrument
 ]

The thickness of the candle body adjusts relative to the size of the chart as well as the number of data bars.

I'd still like to find a way to change the color of the candle body relative to the relative values of the open and closing prices: red when the open > close, green when open < close.

Anyone know how to do that?


  • Prev by Date: Re: How to convert a HeavisideTheta to a PieceWise function
  • Next by Date: Solve this differential equation with periodic boundary conditions: (u'[x])^3 - u'''[x] = 0
  • Previous by thread: Re: financial chart with volumes
  • Next by thread: Re: financial chart with volumes