MathGroup Archive 2008

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

Search the Archive

Re: financial chart with volumes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88196] Re: [mg88179] financial chart with volumes
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 28 Apr 2008 04:37:46 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

With version 6, this is similar:

financialChart[company_String, startDate_List] :=
  
  financialChart[company, startDate, Take[DateList[], 3]];

financialChart[company_String, startDate_List, endDate_List] :=
  
  Module[
   {dateForm, high, highest, closing, low, lowest,
    volume, maxVolume, minVolume, adjustedVolume},
   dateForm = {"MonthShort", "/", "DayShort", "/", "Year"};

   high = FinancialData[company, "High", {startDate, endDate}];
   highest = Max[high[[All, 2]]];
   closing = FinancialData[company, {startDate, endDate}];
   low = FinancialData[company, "Low", {startDate, endDate}];
   lowest = Min[low[[All, 2]]];
   volume = FinancialData[company, "Volume", {startDate, endDate}];
   maxVolume = Max[volume[[All, 2]]];
   minVolume = Min[volume[[All, 2]]];
   adjustedVolume = {#[[1]], ((3*lowest - highest) +
          (highest - lowest) (#[[2]] - minVolume)/
            (maxVolume - minVolume))/2} & /@ volume;

   DateListPlot[{high, closing, low, adjustedVolume},
    Filling -> {1 -> {{3}, Red},
      4 -> {(3*lowest - highest)/2, {{Thick, Darker[Green, .6]}}}},
    GridLines -> Automatic,
    PlotMarkers -> {"", Style["-", {Bold, Black}], "", ""},
    FrameLabel -> {None, "Price in Dollars ($)"},
    PlotLabel -> 
     FinancialData[company, "StandardName"] <> " (" <>
      
      FinancialData[company, "Symbol"] <> 
      ") Common Stock, " <>
      DateString[startDate, dateForm] <> 
      " - " <>
      DateString[endDate, dateForm],
    ImageSize -> 500]];

financialChart["LLL", DatePlus[-90]]


Bob Hanlon

---- tomtim20 <tomtim20 at gmail.com> wrote: 
> are there examples to plot such chart ?
> http://www.wolfram.com/solutions/finance/images/fibonarcs.gif
> 
> (the picture is from here: http://www.wolfram.com/solutions/finance/features.html
> )
> 



  • Prev by Date: Notebook[]
  • Next by Date: How to open a Package
  • Previous by thread: financial chart with volumes
  • Next by thread: Change integral variables