Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
MAXPERIOD = 10
|
||||
FOR n = 1 TO 5
|
||||
PRINT "Number = ";n TAB(12) " SMA3 = ";FNsma(n,3) TAB(30) " SMA5 = ";FNsma(n,5)
|
||||
NEXT
|
||||
FOR n = 5 TO 1 STEP -1
|
||||
PRINT "Number = ";n TAB(12) " SMA3 = ";FNsma(n,3) TAB(30) " SMA5 = ";FNsma(n,5)
|
||||
NEXT
|
||||
END
|
||||
|
||||
DEF FNsma(number, period%)
|
||||
PRIVATE nums(), accum(), index%(), window%()
|
||||
DIM nums(MAXPERIOD,MAXPERIOD), accum(MAXPERIOD)
|
||||
DIM index%(MAXPERIOD), window%(MAXPERIOD)
|
||||
accum(period%) += number - nums(period%,index%(period%))
|
||||
nums(period%,index%(period%)) = number
|
||||
index%(period%) = (index%(period%) + 1) MOD period%
|
||||
IF window%(period%)<period% window%(period%) += 1
|
||||
= accum(period%) / window%(period%)
|
||||
Loading…
Add table
Add a link
Reference in a new issue