Using TSQL to Create Financial Technical Indicators Efficiently

I am going through an exercise where I’m trying to find a way to compute stock metrics (technical indicators). What I need is a way to iterate over the rows in a database, computing each technical indicator, then putting that value into the table’s row for that date.

I found an example, and modified it to work on SQL SERVER 2008 R2. I hope you, too, find this solution extremely interesting:

This produces this clean output in the temp table created:

And THAT is how its done!

Leave a Reply

Your email address will not be published. Required fields are marked *