Talk:Averages/Simple moving average: Difference between revisions

→‎Lua problem: Not quite resolved...
(→‎Lua problem: Not quite resolved...)
Line 14:
 
==Lua problem==
The luslua entry haashas a problem. A moving average is of the last N items if N is 5 for example then it is an averaage of the ''last'' (no more than) 5 items. When a sixth item comes along you must drop the first and average the last five, i.e. the second to the sixth items. I was going to say check the wp link given, but it seems to be obfuscated by its terminology - oh well. --[[User:Paddy3118|Paddy3118]] 06:40, 5 February 2010 (UTC)
::Fixed, my good man. Task description could be clearer, I guess.
Thanks for looking in on this problem. Looking at the update, the routine seems to have a fixed period of 10. The idea is to '''call a routine, that would produce your routine''', in effect. I.e. I call a routine and say I want it to produce an SMA with period 10 and it returns a routine that will compute a simple moving average with period 10; I call a routine and give it a period of 22, and it produces a routine that I can use independently to generate a simple moving average of period 22. It is the action of I() the initialiser in the updated task description. I explained the action of the initialiser without writing pseudo-code as the initialiser would be different for an OO, class based implementation, and a procedural implementation for example. --[[User:Paddy3118|Paddy3118]] 03:50, 7 February 2010 (UTC)
Anonymous user