Forecasting Graph

Date: 1982
Type: Program
Platform(s): TS 1000
Tags: Business

Forecasting Graph is a comprehensive time-series analysis and forecasting program that manages up to 13 named data series, each with up to 60 periods of numeric data. The program offers a menu-driven interface with options including moving averages, growth rate calculation, percentage comparisons, correlation coefficients, series shifting, and a double moving average forecasting algorithm using linear regression with residual error correction terms. A machine code routine is called via RAND USR 16581 to render a bar graph, with parameters such as bar width, graph position, and period count written directly to memory locations 16516–16521 before the call. The program uses a compact variable-naming convention throughout, storing option labels in an array O$() and numeric constants in variables prefixed O (e.g., OA, OD, OG) to save memory.


Program Analysis

Program Structure

The program is organized into numbered subroutine blocks with a main menu dispatch at line 2000 and a secondary options menu at line 5000. The top-level menu (lines 2010–2100) presents six options and uses a computed GOTO VAL Z$*OU+OA to jump to the selected routine. The secondary menu (lines 5005–5095) adds nine more analytical operations via a similar GOTO Z*OE+OM dispatch. Major functional blocks are:

  • Lines 100–299: Utility subroutines (keypress input, display routines, RETURN stubs)
  • Lines 300–499: Data display and array initialization
  • Lines 700–899: Series selection
  • Lines 900–999: Dual-series selection
  • Lines 1000–1199: Array copy and statistics subroutines
  • Lines 1600–1699: Pause-and-POKE utility
  • Lines 2000–2100: Main menu
  • Lines 3000–3999: Series setup (name, period definition, initialization)
  • Lines 4000–4999: Data entry and current-period labeling
  • Lines 5000–5899: Analytical operations (moving average, percentages, growth rates, shift, correlation, copy, statistics)
  • Lines 6000–6800: Graph plotting with machine code rendering
  • Lines 7000–7630: Double moving average forecasting
  • Lines 8000–8080: Save routine
  • Line 9999: STOP

Memory-Optimized Variable Naming

A distinctive feature throughout is the use of short symbolic variables (prefixed O) to represent frequently used numeric constants and GOSUB targets. This reduces the number of literal digits stored in the program and saves tokenized memory. Examples include:

VariableApparent value / role
OAMain menu line (2000)
OBDisplay header GOSUB / PAUSE value
ODMaximum series count
OGMaximum periods (60)
OEY/N input GOSUB / multiplier constant (100)
OH, OIPOKE address and value for a system flag
OMSecondary options menu line (5000-range)
OSPeriod threshold for graph layout (25 or 26)
OUMultiplier used in computed GOTO (e.g., 1000)

This technique allows a single variable assignment at startup to configure all branch targets and loop limits, making the program both compact and easily reconfigurable.

Machine Code Graph Renderer

The graph plotting section (lines 6430–6530) writes parameters into a fixed memory block before invoking machine code via RAND USR 16581. The protocol is:

  • POKE 16518, PER — number of bars to draw
  • POKE 16516, Y — horizontal starting position (computed from period count)
  • POKE 16519, Z — bar width (1 or 2 pixels, derived from period count)
  • POKE (16521+K-STA), Z+O2 — per-bar height values written into a sequential byte array

After the machine code returns, the BASIC resumes to overlay axis labels and tick marks (lines 6540–6590) and then prompts for a graph title (lines 6630–6674). The layout of tick marks and label width adapts dynamically based on the number of periods plotted.

Double Moving Average Forecasting Algorithm

The forecasting routine (lines 7270–7595) implements a double moving average method with linear trend extrapolation. For each forecast period I:

  1. A first moving average of width W is computed and stored in the utility array P().
  2. A least-squares slope (SL) and intercept (IN) are derived from the moving average values.
  3. The base forecast MA is projected as SL*(W+I)+IN.
  4. Three residual error correction terms V1, V2, V3 are computed from recent deviations of the moving average from the linear trend and summed as SOS.
  5. The corrected forecast MB = MA + SOS is stored back into P() and written into the time series array T(Z,).

The result leaves the forecast in both the selected series and the utility array for subsequent graphing or analysis.

Data Entry and Display

Data entry (lines 4200–4350) allows up to 60 periods per series. After each value is accepted, it is right-justified into a 7-character field and printed at a computed screen position that wraps across three columns for periods 1–20, 21–40, and 41–60, using the expression AT J-OC*(J>OC)-OC*(J>40), O2+11*(J>OC)+11*(J>40).

Input Validation Idioms

The program uses a consistent pattern for validated single-keypress input: a tight INKEY$ loop (e.g., lines 510–530, 610–660) that filters by character code range. Numeric digit keys map to codes 28–37 on this platform. The dot character (code not in that range) is explicitly allowed for decimal input. The R key (code 114) triggers a GOTO 2000 restart, and V (code 118) sets a field-length variable — both handled as special cases in the extended input subroutine at line 610.

Series Storage

Time series data is held in a two-dimensional array T() indexed by series number and period. String metadata (names, period labels, current-period identifiers) is held in parallel string arrays T$(), P$(), and Q$(). A separate utility floating-point array P() holds intermediate computed results such as moving averages, percentages, and growth rates between analysis and graphing steps.

Notable Techniques

  • Computed GOTO using VAL Z$*OU+OA dispatches the main menu without an IF-chain.
  • Series shift (line 5432) uses a single FOR loop with a SGN Y step and conditional bounds to handle both left and right shifts without duplicating code.
  • The correlation coefficient (lines 5524–5532) is computed as the mean of standardized products, normalizing each series by its mean and standard deviation.
  • POKE OH, OI (lines 1610, 3510, 7620) is used after certain operations, likely to reset a system flag (such as the FAST/SLOW mode indicator or a display flag).
  • The REM block at line 10 contains the embedded machine code routine that is called at line 6530; the bytes include a recognizable Z80 sequence with absolute addresses into the display file area.

Content

Appears On

Related Products

Takes raw data and projects sales, profits, inflation, and other trends. Computes a moving average that smooths out seasonal and...

Related Articles

Related Content

Image Gallery

Source Code

  10 REM 8D401C003033333333333833333333859DF13161C16161417181D2220201E3333333333333333333333218640002B2B002B36402B36893A87403288402A82405E7B3285403A8540473A84404F169B7ACDB2B3A85404FD7932854020E72184405614723A88403D32884020D0ED5B824013ED5382403A86403D32864020B8C91D1F2021222324251C1D1E1F2021222324251C1D1E1F2021222324251C
  15 REM SZX-TSA V2820605
  20 GOTO OA
 110 LET Z$=INKEY$
 120 IF Z$="" OR Z$<>"Y" AND Z$<>"N" THEN GOTO 110
 199 RETURN 
 203 FAST 
 205 PRINT H$;TAB O8;"%D%E%S%C%R%I%P%T%I%O%N      %P%E%R%I%O%D"
 210 FOR K=O1 TO OD
 220 PRINT TAB O1;K;".";TAB O4;T$(K);" ";P$(K)
 230 NEXT K
 240 SLOW 
 299 RETURN 
 300 FAST 
 307 PRINT AT O1,O0;I;"  ";T$(K);" ";P$(K)
 310 FOR J=O1 TO OC
 315 FOR L=O0 TO 40 STEP OC
 320 LET Z$="       "
 325 LET Y$=STR$ T(I,J+L)
 330 IF LEN Y$>=O7 THEN GOTO 345
 335 LET Z$(O7-LEN Y$ TO O7)=Y$
 340 GOTO 350
 345 LET Z$=Y$( TO O7)
 350 PRINT J+L;
 355 IF J+L<10 THEN PRINT " ";
 360 PRINT "##";Z$;
 365 IF L<30 THEN PRINT "% ";
 370 NEXT L
 375 NEXT J
 380 SLOW 
 399 RETURN 
 410 FOR K=O1 TO OG
 420 LET P(K)=O0
 430 NEXT K
 499 RETURN 
 510 LET Z$=INKEY$
 520 IF Z$="" OR CODE Z$<28 AND Z$<>"." OR CODE Z$>37 THEN GOTO 510
 530 LET Y$=Y$+Z$
 599 RETURN 
 610 LET Z$=INKEY$
 620 IF Z$="" OR CODE Z$<28 AND Z$<>"." OR CODE Z$>37 AND CODE Z$<>114 AND CODE Z$<>118 THEN GOTO 610
 630 IF CODE Z$=114 THEN GOTO 2000
 640 IF CODE Z$=118 THEN GOTO 690
 650 LET Y$=Y$+Z$
 660 RETURN 
 690 LET L=O7
 699 RETURN 
 705 CLS 
 720 GOSUB OB
 730 PRINT ,,"WHICH TIME SERIES DO YOU WISH TO USE ?  ####"
 740 INPUT Y
 750 IF Y>OD THEN GOTO 740
 760 PRINT AT OC,O8;Y
 770 LET I=Y
 780 LET K=Y
 790 PRINT "ACCEPT ?"
 800 GOSUB OE
 810 IF Z$="N" THEN GOTO 700
 820 CLS 
 899 RETURN 
 910 CLS 
 920 PRINT H$,,O$(O),,,"ENTER NO. OF SERIES %A"
 930 INPUT A
 940 IF A>OD THEN GOTO 930
 945 PRINT AT O5,OF;A
 950 PRINT ,,"ENTER NO. OF SERIES %B"
 960 INPUT I
 970 IF I>OD THEN GOTO 960
 980 PRINT AT O7,OF;I
 999 RETURN 
 1010 FOR J=O1 TO OG
 1020 LET P(J)=T(I,J)
 1030 NEXT J
 1099 RETURN 
 1110 LET SQ=O0
 1120 LET SU=O0
 1130 FOR J=O1 TO PER
 1140 LET SU=SU+T(I,J)
 1150 LET SQ=SQ+T(I,J)**O2
 1160 NEXT J
 1170 LET AV=SU/PER
 1180 LET DEV=SQR (SQ/PER-AV**O2)
 1199 RETURN 
 1600 PAUSE OB
 1610 POKE OH,OI
 1699 RETURN 
 2010 CLS 
 2020 PRINT H$,,TAB OW;"%O%P%T%I%O%N%S"," "
 2030 FOR K=O1 TO O6
 2040 PRINT " ";K;". ";O$(K);,,,
 2050 NEXT K
 2060 PRINT ,,TAB O5;"ENTER OPTION."
 2070 LET Z$=INKEY$
 2080 IF Z$="" OR CODE Z$<29 OR CODE Z$>34 THEN GOTO 2070
 2090 CLS 
 2100 GOTO VAL Z$*OU+OA
 3020 GOSUB OB
 3050 PRINT ,,"ENTER NO. OF SERIES TO BE SET UP"
 3060 INPUT I
 3070 IF I>OD THEN GOTO 3060
 3100 PRINT AT 18,OD;I
 3130 IF T$(I)=M$ THEN GOTO 3200
 3140 PRINT "TIME SERIES ";I;" IN USE - PROCEED ?"
 3150 GOSUB OE
 3160 IF Z$="N" THEN GOTO OA
 3200 CLS 
 3210 PRINT H$,," TIME SERIES NUMBER ";I,,," TIME SERIES NAME (MAX 19 CHR$ )",,,"  ";M$
 3220 INPUT Y$
 3230 IF LEN Y$>19 THEN GOTO 3220
 3280 PRINT AT O6,O2;Y$
 3310 PRINT ,," PERIOD DEFINITION (MAX 7 CHR$ )"
 3330 INPUT X$
 3340 IF LEN X$>O7 THEN GOTO 3330
 3380 PRINT AT O9,O2;X$
 3400 PRINT ,," ACCEPT ?"
 3410 GOSUB OE
 3420 IF Z$="N" THEN GOTO 3200
 3430 LET T$(I)=Y$
 3440 LET P$(I)=X$
 3450 LET Q$(I)="####################"
 3455 FAST 
 3460 FOR J=O1 TO OG
 3470 LET T(I,J)=O0
 3480 NEXT J
 3485 SLOW 
 3490 PRINT ,,,," SERIES NOW SET UP WITH 60 BLANK PERIODS"
 3500 PAUSE OB
 3510 POKE OH,OI
 3999 GOTO OA
 4010 PRINT H$
 4015 GOSUB OJ
 4020 GOSUB OK
 4030 SCROLL 
 4040 PRINT "NO. OF PERIODS DATA TO ENTER? @@@@"
 4050 INPUT Y
 4060 IF Y>OG THEN GOTO 4050
 4100 PRINT AT  OT,O0;Y;" PERIODS STARTING PERIOD ?  @@@@"
 4110 INPUT STA
 4120 IF STA<O1 OR STA>OG THEN GOTO 4110
 4200 FOR J=STA TO STA+Y-1
 4210 PRINT AT  OT,O0;"PERIOD ";J;" ##############";M$( TO 15)
 4220 INPUT X
 4230 IF LEN (STR$ X)>O7 THEN GOTO 4220
 4240 PRINT AT  OT,OL;X
 4260 PRINT AT  OT,18;"ACCEPT ?"
 4270 GOSUB OE
 4280 IF Z$="N" THEN GOTO 4210
 4290 LET T(I,J)=X
 4300 LET Y$="       "
 4310 LET Z$=STR$ T(I,J)
 4320 LET L=LEN Z$
 4330 LET Y$(O8-L TO )=Z$
 4340 PRINT AT  J-OC*(J>OC)-OC*(J>40),O2+11*(J>OC)+11*(J>40);Y$
 4350 NEXT J
 4500 CLS 
 4510 PRINT H$,,"PERIOD ";Q(I);" CURRENTLY IDENTIFIED   AS ";Q$(I),"CHANGE THIS ? @@"
 4520 GOSUB OE
 4530 IF Z$="N" THEN GOTO OA
 4540 PRINT ;,,"ENTER NEW PERIOD AND IDENTIFY",,,"@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
 4550 INPUT Y
 4560 IF LEN (STR$ Y)>O2 THEN GOTO 4550
 4570 PRINT AT  O9,O0;Y
 4590 INPUT X$
 4600 IF LEN X$>15 THEN GOTO 4590
 4620 PRINT AT  O9,O5;X$
 4640 PRINT ,,"ACCEPT ?"
 4650 GOSUB OE
 4660 IF Z$="N" THEN GOTO 4500
 4670 LET Q(I)=Y
 4680 LET Q$(I)=X$
 4999 GOTO OA
 5005 CLS 
 5010 PRINT H$,,TAB OW;"OPTIONS",
 5020 FOR K=O7 TO 15
 5030 PRINT " ";K-O6;". ";O$(K)
 5040 NEXT K
 5050 PRINT ,,"ENTER OPTION"
 5060 INPUT Z
 5070 IF Z<O1 OR Z>O9 THEN GOTO 5060
 5092 LET O=Z+6
 5095 GOTO Z*OE+OM
 5100 GOSUB OJ
 5102 IF I>OD THEN GOTO 5100
 5104 PRINT TAB O5;O$(O7),,,"HOW MANY PERIODS IN MOVING AVERAGE ? @@@@"
 5106 INPUT PER
 5108 IF PER>30 THEN GOTO 5106
 5110 PRINT AT  O3,O8;PER
 5120 FAST 
 5126 GOSUB ON
 5128 FOR J=PER TO OG
 5130 FOR K=O1 TO PER
 5132 LET P(J)=P(J)+T(I,J-K+O1)
 5134 NEXT K
 5136 NEXT J
 5138 SLOW 
 5140 PRINT ,,"MOVING AVERAGE OF SERIES ";I;A$
 5150 GOSUB OX
 5199 GOTO OM
 5200 GOSUB OP
 5204 GOSUB ON
 5205 FAST 
 5206 FOR J=O1 TO OG
 5207 IF T(I,J)=O0 THEN LET P(J)=999999
 5208 IF T(I,J)=O0 THEN GOTO 5210
 5209 LET P(J)=T(A,J)*OE/T(I,J)
 5210 NEXT J
 5212 SLOW 
 5214 PRINT "PERCENTAGES";A$
 5216 GOSUB OX
 5299 GOTO OM
 5300 GOSUB OJ
 5302 PRINT H$,,O$(O),,,"ENTER NO.OF PERIODS LAG  @@@@"
 5304 INPUT LAG
 5310 PRINT AT  O5,27;LAG
 5316 IF LAG<O1 OR  LAG>58 THEN GOTO 5300
 5317 FAST 
 5318 GOSUB ON
 5320 FOR J=O1+LAG TO OG
 5321 IF NOT T(I,J-LAG) THEN LET P(J)=999999
 5322 IF NOT T(I,J-LAG) THEN GOTO 5324
 5323 LET P(J)=T(I,J)*OE/T(I,J-LAG)-OE
 5324 NEXT J
 5325 SLOW 
 5326 PRINT ,,"GROWTH RATES COMPUTED AND";A$
 5328 GOSUB OX
 5399 GOTO OM
 5400 GOSUB OJ
 5402 PRINT H$,,O$(O),,,"ENTER NO.OF PERIODS SHIFT @@@@"
 5404 INPUT Y
 5406 IF Y>=OG THEN GOTO 5404
 5410 PRINT AT  O5,26;Y
 5416 PRINT ,,"DIRECTION OF SHIFT?",,"LEFT%< OR RIGHT %>  @@"
 5418 LET Z$=INKEY$
 5420 IF Z$<>"<" AND Z$<>">" THEN GOTO 5418
 5422 IF Z$="<" THEN LET Y=Y*-O1
 5424 PRINT AT  O8,18;Z$
 5426 PRINT ,,"ACCEPT ?"
 5428 GOSUB OE
 5430 IF Z$="N" THEN GOTO 5400
 5431 FAST 
 5432 FOR J=O0+O1*(Y<O0)+OG*(Y>O0) TO (O1*(Y>O0)+Y*(Y>O0))+(OG+Y)*(Y<O0) STEP -O1*(SGN Y)
 5434 LET T(I,J)=T(I,J-Y)
 5436 NEXT J
 5437 SLOW 
 5438 PRINT ,,"SERIES NO. ";I;" SHIFTED ";Y;" PERIODS"
 5440 GOSUB OX
 5499 GOTO OM
 5500 GOSUB OP
 5502 IF A>OD OR I>OD THEN GOTO 5500
 5504 FAST 
 5506 LET B=I
 5508 LET I=A
 5509 LET PER=OG
 5510 GOSUB OR
 5512 LET AA=AV
 5514 LET SA=DEV
 5516 LET I=B
 5518 GOSUB OR
 5520 LET AB=AV
 5522 LET SB=DEV
 5524 LET Z=O0
 5526 FOR J=O1 TO OG
 5528 LET Z=Z+((T(A,J)-AA)/SA)*((T(B,J)-AB)/SB)
 5530 NEXT J
 5532 LET Z=Z/OG
 5533 SLOW 
 5534 PRINT ,,"CORRELATION COEFFICIENT IS ";Z
 5538 PRINT K$
 5540 IF INKEY$="" THEN GOTO 5540
 5599 GOTO OM
 5600 GOSUB OJ
 5602 GOSUB OK
 5603 SCROLL 
 5604 PRINT "PRESS %C TO COPY-ANY TO RETURN"
 5606 LET Z$=INKEY$
 5608 IF Z$="" THEN GOTO 5606
 5610 IF Z$="C" THEN COPY 
 5699 GOTO OM
 5700 GOSUB OJ
 5702 PRINT H$,,O$(O),,,"ENTER %1 TO COPY TO OR %2 TO COPY FROM THE UTILITY SERIES"
 5704 INPUT Y
 5706 IF Y<O1 OR Y>O2 THEN GOTO 5704
 5708 FAST 
 5710 IF Y=O2 THEN GOTO 5716
 5712 GOSUB OU
 5714 GOTO 5722
 5716 FOR J=O1 TO OG
 5718 LET T(I,J)=P(J)
 5720 NEXT J
 5722 PRINT ,,"SERIES COPIED"
 5723 SLOW 
 5724 GOSUB OX
 5799 GOTO OM
 5800 GOSUB OJ
 5802 PRINT H$,,O$(O),"ENTER NUMBER OF RELEVANT PERIODS"
 5804 INPUT PER
 5806 IF PER>OG THEN GOTO 5804
 5808 PRINT ,PER
 5814 FAST 
 5816 GOSUB OR
 5818 PRINT ,,"STANDARD DEVIATION IS ";DEV,"MEAN IS ";AV
 5820 SLOW 
 5828 PRINT K$
 5830 IF INKEY$="" THEN GOTO 5830
 5899 GOTO OM
 5900 GOTO OA
 6100 CLS 
 6110 PRINT H$,,"          %G%R%A%P%H% %P%L%O%T",,,"NUMBER OF START PERIOD ? ";
 6120 INPUT STA
 6155 PRINT STA
 6170 IF STA<O1 OR  STA>=OG THEN GOTO 6100
 6180 PRINT ,,"NUMBER OF PERIODS ? ";
 6190 INPUT PER
 6230 PRINT PER
 6250 IF STA+PER-O1>OG THEN GOTO 6100
 6260 LET Y=P(STA)
 6270 LET Z=P(STA)
 6280 FOR K=STA TO STA+PER-O1
 6290 IF P(K)<Y THEN LET Y=P(K)
 6300 IF P(K)>Z THEN LET Z=P(K)
 6310 NEXT K
 6320 PRINT ,,"MAXIMUM VALUE IN RANGE IS ";Z,"MINIMUM VALUE IN RANGE IS ";Y,"RANGE IS ";Z-Y,,"ENTER BASE VALUE FOR PIXEL 0 ";
 6330 INPUT X
 6340 PRINT X
 6350 PRINT "ENTER TOP VALUE FOR PIXEL 36 ";
 6360 INPUT W
 6370 PRINT W
 6390 IF X>Y OR W<Z THEN GOTO 6100
 6400 PRINT "%B%A%S%E% %V%A%L%U%E% %I%S    ";X,"%M%I%N%I%M%U%M% %V%A%L%U%E% %I%S ";Y,"%M%A%X%I%M%U%M% %V%A%L%U%E% %I%S ";Z,"%T%O%P% %O%F% %G%R%A%P%H% %I%S ";W,"ACCEPT ?"
 6410 GOSUB OE
 6420 IF Z$="N" THEN GOTO 6000
 6430 CLS 
 6435 FAST 
 6440 LET F=(W-X)/36
 6450 FOR K=STA TO STA+PER-O1
 6460 LET Z=INT ((P(K)-X)/F)
 6470 IF Z<O1 THEN LET Z=O1
 6480 POKE (16521+K-STA),Z+O2
 6490 NEXT K
 6500 POKE 16518,PER
 6505 LET Y=O4+12*(PER<OS)+INT (.5*(OG-PER)*(PER<OG AND PER>25))
 6507 POKE 16516,Y
 6510 LET Z=O1*(PER>24)+O2*(PER<OS)+O1*(PER<15)
 6520 POKE 16519,Z
 6525 SLOW 
 6530 RAND USR 16581
 6540 LET X=INT (Y/O2)
 6550 IF X<3 THEN GOTO 6630
 6560 FOR K=18 TO O0  STEP -O2
 6565 LET X$=M$( TO X-O1)
 6570 LET Z$=STR$ (W-(F*((K*O2)-O1)))
 6571 IF LEN Z$>=X THEN GOTO 6574
 6572 LET X$((X-O1)-LEN Z$ TO X-O1)=Z$
 6573 GOTO 6575
 6574 LET X$=Z$( TO X-O1)
 6575 PRINT AT  K+O2,O0;X$;TAB X-O1;"##"
 6580 PRINT AT  K+O3,X-O1;"@@"
 6590 NEXT K
 6630 PRINT AT  O0,O0;"%E%N%T%E%R% %T%I%T%L%E"
 6640 INPUT Z$
 6650 LET L=INT ((LEN Z$)/O2)
 6660 PRINT AT  O0,O0;"           "
 6670 PRINT AT  O0,16-L;Z$
 6672 INPUT Z$
 6674 PRINT AT OT,O0;Z$
 6760 LET Z$=INKEY$
 6770 IF Z$="C" THEN COPY 
 6790 IF CODE Z$<>OV THEN GOTO 6760
 6800 GOTO OA
 7010 GOSUB OJ
 7020 PRINT H$,,"          %F%O%R%E%C%A%S%T%I%N%G",,,"ENTER NO. OF PERIODS IN MOVING  AVERAGE"
 7030 INPUT W
 7040 IF W>30 THEN GOTO 7030
 7060 PRINT AT O6,O8;W
 7090 PRINT ,,"ENTER NO. OF PERIODS TO BE      FORECAST"
 7100 INPUT PER
 7130 PRINT AT  O9,OL;PER
 7160 PRINT ,,"ENTER NO. OF START PERIOD FOR   FORECAST"
 7170 INPUT X
 7200 PRINT AT  OW,OL;X
 7230 IF X-W*O2>=O1 AND X+PER<=OG THEN GOTO 7270
 7240 PRINT "PARAMETERS DO NOT FIT"
 7250 GOSUB OX
 7265 GOTO 7000
 7270 FAST 
 7280 GOSUB ON
 7300 LET FZ=O0
 7310 LET FX=O0
 7320 FOR K=O1 TO W
 7330 LET FZ=FZ+K**O2
 7340 LET FX=FX+K
 7350 NEXT K
 7355 LET Z=I
 7360 FOR J=O1 TO W
 7370 LET MA=O0
 7380 FOR K=O1 TO W
 7390 LET MA=MA+T(Z,J+X-O2*W+K-O1)
 7400 NEXT K
 7410 LET P(X-W+J-O1)=MA
 7420 NEXT J
 7430 FOR I=1 TO PER
 7440 LET SY=O0
 7450 LET SX=O0
 7460 FOR K=O1 TO W
 7470 LET SY=SY+P(X+I-W+K-O2)
 7480 LET SX=SX+P(X+I-W+K-O2)*K
 7490 NEXT K
 7500 LET SL=(SY*FX/W-SX)/((FX**O2)/W-FZ)
 7510 LET IN=(SY-SL*FX)/W
 7520 LET MA=SL*(W+I)+IN
 7530 LET V1=.5*(P(X+I-O2)-(SL*(W+I-O1)+IN))
 7540 LET V2=.25*(P(X+I-O3)-(SL*(W+I-O2)+IN))
 7550 LET V3=.25*(P(X+I-O4)-(SL*(W+I-O3)+IN))
 7555 LET SOS=V1+V2+V3
 7560 LET MB=MA+SOS
 7570 LET P(X+I-O1)=MB
 7580 LET T(Z,X+I-O1)=T(Z,X+I-O1-W)+(P(X+I-O1)-P(X+I-O2))
 7590 NEXT I
 7595 SLOW 
 7600 PRINT "FORECAST IS NOW IN  SERIES ";Z,"AND MOVING AVERAGE OF FORECAST","IS IN UTILITY ARRAY"
 7610 PAUSE OB
 7620 POKE OH,OI
 7630 GOTO OA
 8000 PRINT H$,,"SAVE REQUIRED ?"
 8010 GOSUB OE
 8020 IF Z$="N" THEN GOTO 9999
 8030 PRINT "ENTER NAME"
 8040 INPUT Z$
 8050 PRINT "%S%T%A%R%T% %T%A%P%E% %T%H%E%N% %P%R%E%S%S% %A%N%Y% %K%E%Y"
 8060 IF INKEY$="" THEN GOTO 8060
 8070 SAVE Z$
 8075 SLOW 
 8080 GOTO OA
 9999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top