Calculating Moving Averages with T-SQL

  • Comments posted to this topic are about the item Calculating Moving Averages with T-SQL

  • Nice article and Very well explained...



  • All topics are very good here.. when I read this full details so I am very impress to this.........

    Acai Optimum

    weider x factor

  • Lovely piece of work..

  • Gabriel P (3/3/2010)

    Comments posted to this topic are about the item <A HREF="/articles/Moving+Average/69389/">Calculating Moving Averages with T-SQL</A>

    Excellent article, Gabriel. I reckon it's time to start messing with those pesky CTE's again.

    << and therefore isn't a good indicator of what the immediate future might hold. >>

    Have a word with Gail about DBCC TIMEWARP, without too much effort you should get the last ten days and the next ten days.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • hi ..........i m aldon .how 2 improve my sql tech.

  • Great work, thank you! Would love to read more about technical analysis and sql. Or even better: portfolio theory and sql. BTW: does someone know if using MDX / Analysis Server makes sense here (query performance wise)? I guess it could make sense if all you need is the most recent moving average, but I know too little about AS to really have an idea. I was thinking about trying to use AS to calculate securities price correlations. Maybe someone knows if it makes sense to try this at all. After all you need to import the daily securities data into the data mart every day (I hope it is possible to add only the most recent day after an initial import). If someone has any hands on experience about (ten thousands of) time series in AS, I would be most interested...



  • This is very useful and well detailed. Much appreciated!!!


  • Excellent article.

    I have a huge volume of historical data [3 years of data at 15 minute intervals] and will try out the method this weekend


  • This is one of the best articles I have read in a long time. Excellent work.

  • Nice to have an alternative to self joins for the sliding window average. Thanks for the post.

  • Yes, but how we can make connection to some live data source so we can do live trading analyse?


  • So well written and explained. Thanks for taking the time to share this with us.

  • Good code. Good read. Lot's of fun.

    Thanks for the time and effort that you put into writing the article.

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
  • In the immortal words of Paris Hilton, "That's hot". I love the technique and the article is very well written.

    Signature is NULL

Viewing 15 posts - 1 through 15 (of 80 total)

You must be logged in to reply to this topic. Login to reply