Re: financial chart with volumes
- To: mathgroup at smc.vnet.net
- Subject: [mg93738] Re: [mg93701] financial chart with volumes
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 24 Nov 2008 04:15:10 -0500 (EST)
- Reply-to: hanlonr at cox.net
ClearAll[financialChart];
financialChart[company_String, startDate_List] :=
financialChart[company, startDate, Take[DateList[], 3]];
financialChart[company_String, startDate_List, endDate_List] :=
Module[{dateForm1, dateForm2, open, high, highest, closing, low,
lowest, volume, maxVolume, minVolume, adjustedVolume},
dateForm1 = {"MonthShort", "/", "DayShort"};
dateForm2 = {"MonthShort", "/", "DayShort", "/", "Year"};
high = FinancialData[company, "High", {startDate, endDate}];
highest = Max[high[[All, 2]]];
open = FinancialData[company, "Open", {startDate, endDate}];
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]]/maxVolume)/2} & /@ volume;
DateListPlot[{high, closing, low, adjustedVolume, open},
Filling -> {1 -> {{3}, Red}, 4 -> {(3*lowest - highest)/2,
{{Thick, Darker[Green, .6]}}}},
GridLines -> Automatic,
PlotMarkers -> {"", Style["\[LongDash]", {Bold, Black}], "", "",
Style["-", {Bold, Green}]},
FrameLabel -> {None, "Price in Dollars ($)"},
PlotLabel ->
FinancialData[company, "StandardName"] <> " (" <>
FinancialData[company, "Symbol"] <> ") Common Stock, " <>
DateString[startDate, dateForm1] <> " - " <>
DateString[endDate, dateForm2],
ImageSize -> 600]];
financialChart["LLL", DatePlus[-60]]
Bob Hanlon
---- Felix Bamba <felix.bamba at sowget.com> wrote:
=============
Dear sir,
I have found your details on the net at http://forums.wolfram.com/mathgroup/archive/2008/Apr/msg01067.html
.
I am interested in displaying a stock chart on mathematica with open,
high, low and close. Would u be kind enough to point me in the right
direction?
Many thanks
Felix Bamba
felix.bamba at sowget.com
Quote:
"Some folks are wise, and some are otherwise for knowledge is the
information acquired while searching for an answer, not the answer
itself".
--
Bob Hanlon