June 24, 2005 at 12:36 pm
I if understand you right, would feel this is redundant data. Which is not to keep. Why you want to do so?
June 24, 2005 at 12:44 pm
Is not that is redundant is that because you only have let's say AVG for lets say 10 , 20 and 200 spans it makes sense to compute ahead of time so that when you query the data is already materialized wich will mean a blindly fast respose
* Noel
June 24, 2005 at 12:53 pm
I see, but u need another column for AVG, don't u?
June 24, 2005 at 12:56 pm
sure! you are materializing it
* Noel
June 30, 2005 at 3:12 pm
Heres so people get the idea of what exponential moving averages is all about,
http://www.stockcharts.com/education/IndicatorAnalysis/indic_movingAvg.html
I think we are looking for a moving average over a period of time, I would suppose 20 days. Calculating the simple moving average is easy, but as far as EMA,... Its a good puzzle
June 30, 2005 at 3:42 pm
Not a big deal if you do it at INSERT time
* Noel
July 1, 2005 at 4:43 pm
OK so heres where my mind is going in circles,.. any help will be appreciated.
Below is a table with the results of an exponential moving average calculation for Eastman Kodak. For the first period's exponential moving average, the simple moving average was used as the previous period's exponential moving average (yellow highlight for the 10th period). From period 11 onwards, the previous period's EMA was used. The calculation in period 11 breaks down as follows:
Now I am wondering how, in a nutshell, some of you would go about getting this data. We would take the 10 day EMA and populate it into a detail table. I am trying to accomplish this without a cursor. Can anyone think of a way to get this with a view? I'm gonna keep stabbing at it and if I answer my own questions SO BE IT!!
BE NICE HELP A NEW-B!!!
July 3, 2005 at 7:00 am
If you will be using this information often I would create a table fo EMA and store the data in that table not a temp table.
/*
to calculate an exponential moving average.
you will need to store the exponential moving average from the previous day into a table (for the first day
you can use a simple moving average for the data)
the weight is computed by adding one to the number of days in the average
days = 200 + 1 = 201. Divide 2 by this number = 0.00995.
this number times the current price is then added to the previous EMA times
1-(2/201)
todays info price 136
previous EMA = 120
todays EMA = (136 * .00995) + (120 * .99005)=120.16
then store the new moving average in table EMA table
*/
HTH Mike
Viewing 9 posts - 16 through 23 (of 23 total)
You must be logged in to reply to this topic. Login to reply