tag:blogger.com,1999:blog-6950062.post1082006405185414455..comments2023-11-12T03:20:26.385-06:00Comments on TaylorTree: Running Simple Moving Average (SMA)Mike Taylorhttp://www.blogger.com/profile/03074565631668167250noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-6950062.post-46889393303325764172015-12-06T00:32:09.489-06:002015-12-06T00:32:09.489-06:00Believe you are referring to the Running Variance ...Believe you are referring to the Running Variance post in regard to the pval = 0.0 error. I have corrected the code in that post. Thanks! MTMike Taylorhttps://www.blogger.com/profile/03074565631668167250noreply@blogger.comtag:blogger.com,1999:blog-6950062.post-84841563468362713362015-09-28T02:08:15.975-05:002015-09-28T02:08:15.975-05:00Hi Mike, there's an error in the code here. Th...Hi Mike, there's an error in the code here. The pval = 0.0 should be in an else statement. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6950062.post-33621780295231325442010-06-25T14:26:17.000-05:002010-06-25T14:26:17.000-05:00Hi Mike,I'm a recruiter at Google and was curi...Hi Mike,<br><br>I'm a recruiter at Google and was curious if you might be interested in exploring opportunities with us.<br><br>Please let me know if you'd like to chat.<br><br>Sincerely,<br>Christian Bogeberg | bogeberg@google.com<br>Engineering Recruiter | Google Inc., CA<br>Voice:650.762.6645 | Fax:650.963.3269Christian Bogeberghttp://stackoverflow.com/users/375731/cbogienoreply@blogger.comtag:blogger.com,1999:blog-6950062.post-18117654187477846622010-07-07T04:20:46.000-05:002010-07-07T04:20:46.000-05:00I love your website! did you create this yourself ...I love your website! did you create this yourself or did you outsource it? Im looking for a blog design thats similar so thats the only reason I'm asking. Either way keep up the nice work I was impressed with your content really..legit online jobshttp://www.TheBestLegitOnlineJobs.comnoreply@blogger.comtag:blogger.com,1999:blog-6950062.post-44956246949862494302010-07-07T10:31:27.000-05:002010-07-07T10:31:27.000-05:00Thanks! I used the Daily Edition theme from theme...Thanks! I used the <a href="http://www.themesheep.com/display/themes/free-themes/the-daily-edition/" rel="nofollow">Daily Edition</a> theme from <a href="http://www.themesheep.com/" rel="nofollow">themesheep</a>. I believe they have a few other free ones to choose from and of course paid ones as well. Wordpress makes it pretty easy to try out different themes from various sources.<br><br>MTMike Taylornoreply@blogger.comtag:blogger.com,1999:blog-6950062.post-72305247421043586582010-09-11T14:10:05.000-05:002010-09-11T14:10:05.000-05:00[...] covered Running SMAs and EMAs…let’s dig into...[...] covered Running SMAs and EMAs…let’s dig into Running Sums or often called Running Totals. Formula as [...]Running Sum | TaylorTreehttp://taylortree.com/running-sum/noreply@blogger.comtag:blogger.com,1999:blog-6950062.post-53332251992994399342010-08-01T00:16:10.000-05:002010-08-01T00:16:10.000-05:00[...] that we’ve tackled Running Simple Moving Ave...[...] that we’ve tackled Running Simple Moving Averages (SMA)…let’s move on to Exponential Moving Averages (EMA). You may wonder why we’re not [...]TaylorTree » Blog Archive » Exponential Moving Average (EMA)http://taylortree.com/exponential-moving-average-ema/noreply@blogger.comtag:blogger.com,1999:blog-6950062.post-28615735372425509062012-08-10T02:05:00.000-05:002012-08-10T02:05:00.000-05:00Thanks for the algo.Is there a way to calculate th...Thanks for the algo.<br>Is there a way to calculate the value without requiring the <br>series[bar - period] data point as this requires me to store previous data points in a sliding window calculation.Yoginoreply@blogger.comtag:blogger.com,1999:blog-6950062.post-87605318682928706832012-09-02T06:59:00.000-05:002012-09-02T06:59:00.000-05:00No way I know of to avoid storing the previous dat...No way I know of to avoid storing the previous data point in order to obtain the running calculation. Just have to decide where you'd like to store it. You could store it and then use it in the call to your function. Or you could create a class for your logic and memoize the previous data point (cache the value) in the class. Then the object will keep track of it for you through the window.Mike Taylorhttp://www.taylortree.com/noreply@blogger.comtag:blogger.com,1999:blog-6950062.post-44040939268523274762010-11-25T17:55:40.000-06:002010-11-25T17:55:40.000-06:00[...] You also need the Simple Moving Average, whi...[...] You also need the Simple Moving Average, which you can find in one of my previous posts here. [...]Running Variance | TaylorTreehttp://taylortree.com/running-variance/noreply@blogger.comtag:blogger.com,1999:blog-6950062.post-36889131117274651442012-09-02T05:42:00.000-05:002012-09-02T05:42:00.000-05:00Thanks for good info:)How to use this with lists?I...Thanks for good info:)<br>How to use this with lists?<br>I am getting errors when I try:<br><br>print "Today's 3-day SMA = %.4f" % currentsma<br>TypeError: float argument required, not str<br><br>Some solutions?Herbertnoreply@blogger.comtag:blogger.com,1999:blog-6950062.post-31786150786914227502012-09-02T06:50:00.000-05:002012-09-02T06:50:00.000-05:00The example code is using a list (prices). Are yo...The example code is using a list (prices). Are you asking is there a way to pass a full list to running_sma to obtain list of running simple moving averages? Yes, but you'd have to restructure running_sma to expect a list of values instead of a value & previous value. Then perform the for bar, close in enumerate(prices) logic within the running_sma function. And of course, then return a list of values back instead of a value. This is basically what I did in my statio package on github - https://github.com/TaylorTree/statio.<br><br><br>Here's the sample code from the statio sma_values function:<br><br><br>def sma_values(values, period=None): """Returns list of running simple moving averages.<br> :param values: list of values to iterate and compute stats. :param period: (optional) # of values included in computation. * None - includes all values in computation. :rtype: list of simple moving averages.<br> Examples: >>> values = [34, 30, 29, 34, 38, 25, 35] >>> results = sma_values(values, 3) #using 3 period window. >>> ["%.2f" % x for x in results] ['34.00', '32.00', '31.00', '31.00', '33.67', '32.33', '32.67'] """ if period: if period < 1: raise ValueError("period must be 1 or greater")<br> period_n = float(period) period = int(period)<br> results = [] lastval = None for bar, newx in enumerate(values): if lastval == None: lastval = float(newx)<br> elif (not period) or (bar < period): lastval += ((newx - lastval) / (bar + 1.0))<br> else: lastval += ((newx - values[bar - period]) / period_n)<br> results.append(lastval)<br> return resultsMike Taylorhttp://www.taylortree.com/noreply@blogger.com