Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11458
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Problems with dynamic tables |
| Date | 2012-08-23 06:53 +0000 |
| Message-ID | <k14k11$7fu$1@smc.vnet.net> (permalink) |
| References | <20120822062700.4382F684C@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Manipulate[
Module[{data, movAvg},
data = FinancialData[company, "Jan. 1, 2011"];
movAvg = Thread[{
Drop[data[[All, 1]], n - 1],
MovingAverage[data[[All, 2]], n]}];
DateListPlot[{data, movAvg},
Joined -> {False, True},
PlotLabel -> FinancialData[company, "Name"]]],
{{company, "IBM"}, {"AAPL", "GOOG", "IBM"}},
{{n, 15, "window size"}, Range[5, 30, 5]}]
Bob Hanlon
On Wed, Aug 22, 2012 at 2:27 AM, tarpanelli@libero.it
<tarpanelli@libero.it> wrote:
> Hello,
>
> I am using FinancialData and plotting the real time data using a DateListPlot.
> What I would like to do is to add to the DateListPlot of prices also a moving
> average of the same price time series, in real time:
>
> for example, for each updated price I would like to have the corresponding
> moving average value accroding to the last n prices.
>
> I was trying to do this by creating a Dynamic table where I put all the prices
> and then get the sum of last n elements to compute the moving averange over the
> last horizon of time of length n, but I am blocked.
>
> Is there any one who already suceeded to do a similar job?
>
> thanks
> Paolo
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Problems with dynamic tables Bob Hanlon <hanlonr357@gmail.com> - 2012-08-23 06:53 +0000
csiph-web