home *** CD-ROM | disk | FTP | other *** search
Wrap
GW-BASIC | 1984-05-28 | 12.7 KB | 268 lines
10 REM STOCK MINDER Copyright (c) 1984 by Ron Lashley 20 DEFINT A-B,I-J,V:DIM DAYS(12),MAV(53),Y2(53),FL(30,52),NM$(30),DTS(52),SLOPE(31),MEAN(31),SDEV(31),LST(31),BETA(31),ACT$(31),ISTKN(30),VL(30) 30 FOR I=1 TO 3:FOR J=1 TO 3:READ SB$(I,J):NEXT J,I:FOR I=1 TO 12:READ DAYS(I):NEXT I 40 SCREEN 0:WIDTH 80:CLS:COLOR 7,0:KEY OFF:FOR I=1 TO 10:KEY I,"":NEXT 50 COLOR 14,0:LOCATE 10,35:PRINT "STOCK MINDER" 60 LOCATE 12,25:PRINT "COPYRIGHT (C) 1984 BY RON LASHLEY" 190 REM ----- Switch Stock List 200 COLOR 7,0:LOCATE 22,21:PRINT "YOU ARE PRESENTLY IN STOCK LIST # "DTA 205 LOCATE 23,21,1:PRINT "WHICH STOCK LIST DO YOU WANT (1,2,OR 3): "; 210 AN$=INKEY$:IF AN$="" THEN 210 ELSE PRINT AN$; 212 IF ASC(AN$)=13 THEN 205 214 J1=POS(V)-1:IF VAL(AN$)<1 OR VAL(AN$)>3 THEN LOCATE ,J1,0:PRINT " ";:LOCATE ,J1,1:GOTO 210 216 IF DTA=VAL(AN$) THEN 330 ELSE DTA=VAL(AN$) 218 LOCATE 24,35,0:COLOR 30,0:PRINT"LOADING DATA"; 220 ON ERROR GOTO 320 230 ON DTA GOTO 240,250,260 240 OPEN "DATA1" FOR INPUT AS #1:GOTO 270 250 OPEN "DATA2" FOR INPUT AS #1:GOTO 270 260 OPEN "DATA3" FOR INPUT AS #1 270 ON ERROR GOTO 0:INPUT #1,A,B 285 FOR I=1 TO A:INPUT#1,NM$(I):NEXT I 290 IF B>0 THEN FOR I=1 TO B:INPUT#1,DTS(I):NEXT I 300 IF B>0 THEN FOR I=1 TO A:FOR J=1 TO B:INPUT#1,FL(I,J):NEXT J,I 310 CLOSE:GOTO 330 320 GOSUB 4200:RESUME 330 330 REM ----- Main Menu 335 ON ERROR GOTO 0:CLS:LOCATE ,,0:COLOR 14,0:PRINT TAB(29)"STOCK MINDER MAIN MENU":COLOR 7,0:GOSUB 4100 340 PRINT:PRINT TAB(25)"1 - ADD OR DELETE STOCK" 350 PRINT TAB(25)"2 - UPDATE STOCK PRICES" 360 PRINT TAB(25)"3 - GRAPH STOCK PERFORMANCE" 370 PRINT TAB(25)"4 - HIGH - LOW - LAST" 380 PRINT TAB(25)"5 - BUY/SELL ANALYSIS" 390 PRINT TAB(25)"6 - SORT STOCKS" 400 PRINT TAB(25)"7 - PRINT PRICE HISTORY" 410 PRINT TAB(25)"8 - SWITCH STOCK LIST" 420 LOCATE 23:COLOR 14,0:PRINT TAB(25)"ENTER CHOICE (<ESCAPE> TO EXIT): ";:LOCATE ,,1:COLOR 7,0 430 AN$=INKEY$:IF AN$="" THEN 430 ELSE PRINT AN$; 432 IF ASC(AN$)=13 THEN 420 434 IF ASC(AN$)=27 THEN 3000 436 J1=POS(V)-1:IF VAL(AN$)<1 OR VAL(AN$)>8 THEN LOCATE ,J1,0:PRINT " ";:LOCATE ,J1,1:GOTO 430 440 ON VAL(AN$) GOTO 450,700,1100,1480,2020,2715,1640,190 450 REM ----- Add/Delete Stock 460 CLS:LOCATE ,,0:PRINT TAB(30);:COLOR 14,0:PRINT "ADD/DELETE STOCK":PRINT:PRINT 465 PRINT TAB(22)"(A)dd or (D)elete (Enter Letter): ";:LOCATE ,,1:COLOR 7,0:VST=A 470 AN$=INKEY$:IF AN$="" THEN 470 ELSE PRINT AN$ 475 IF AN$="D" OR AN$="d" THEN 555 ELSE IF AN$<>"A" AND AN$<>"a" THEN 330 480 IF A<30 THEN 500 485 PRINT:PRINT TAB(20)"STOCK LIST IS FULL.":PRINT TAB(10)"PRESS ANY KEY TO RETURN TO MENU." 490 AN$=INKEY$:IF A$="" THEN 490 ELSE GOTO 330 500 PRINT TAB(27)"ENTER NAME - PRESS <ENTER>." 505 PRINT TAB(27)"PRESS <ENTER> ONLY FOR MENU." 510 PRINT:PRINT " ENTER NAMES WITH MARKET IN PARENTHESES [i.e. AVX(N) ]-- 12 CHARACTERS MAX." 515 A=A+1:WHILE A<31:PRINT TAB(27)"STOCK # "A": ";:J1=POS(V):LOCATE ,,1:LINE INPUT NM$(A):IF NM$(A)="" THEN 550 520 IF A=1 THEN 535 525 X=0:FOR I=1 TO A-1:IF NM$(A)=NM$(I) THEN X=1 530 NEXT I:IF X=1 THEN PRINT TAB(27)"NAME ALREADY IN LIST";:FOR I1=1 TO 1500:NEXT I1:LOCATE ,27,0:PRINT SPACE$(20);:I1=CSRLIN-1:LOCATE I1,J1,0:PRINT SPACE$(30);:LOCATE I1-1,J1,0:GOTO 545 535 IF LEN(NM$(A))>12 THEN PRINT TAB(27)"NAME TOO LONG";:FOR I1=1 TO 1500:NEXT I1:LOCATE ,27,0:PRINT SPACE$(20);:I1=CSRLIN-1:LOCATE I1,J1,0:PRINT SPACE$(30);:LOCATE I1-1,J1,0:GOTO 545 540 FOR I=1 TO B:FL(A,I)=0:NEXT I:A=A+1 545 WEND 550 A=A-1:IF A=VST THEN 330 ELSE 2900 555 IF A=0 THEN GOSUB 5000:GOTO 330 557 CLS:LOCATE ,,0:PRINT:PRINT TAB(32)"STOCKS ON RECORD":GOSUB 4100 560 PRINT:PRINT TAB(17)"ENTER # TO BE DELETED, PRESS <ENTER>." 570 PRINT TAB(23)"PRESS <ENTER> ONLY TO END.":PRINT 580 PRINT TAB(20)"STOCK # TO DELETE:";:J1=POS(V)+1:LOCATE ,,1:INPUT" ",AN$:IF AN$="" THEN 650 590 DLT=VAL(AN$):IF DLT<1 OR DLT>A THEN GOSUB 5500:GOTO 580 600 PRINT TAB(20)"CONFIRM "NM$(DLT)" (Y/N): ";:LOCATE ,,1:GOSUB 5400 620 IF AN$="N" OR AN$="n" THEN I1=CSRLIN-1:LOCATE ,20,0:PRINT SPACE$(40);:LOCATE I1,J1,0:PRINT" ";:LOCATE I1-1:GOTO 580 640 FOR I=DLT+1 TO A:NM$(I-1)=NM$(I):IF B>0 THEN FOR J=1 TO B:FL(I-1,J)=FL(I,J):NEXT J 645 NEXT I:NM$(A)="":FOR I=1 TO A:FL(I,A)=0:NEXT I:A=A-1:PRINT TAB(25)"DELETED":FOR I=1 TO 1500:NEXT I:GOTO 555 650 IF A=VST THEN 330 ELSE 2900 700 REM ----- Update Stock Prices 710 CLS:LOCATE ,,0:COLOR 14,0:PRINT TAB(30)"UPDATE STOCK PRICES":COLOR 7,0:PRINT:PRINT 715 IF A=0 THEN GOSUB 5000:GOTO 330 720 PRINT"ENTER DATE OF PRICES: MONTH/DAY/YEAR (i.e. 6/20/84):";:LOCATE ,,1:J1=POS(V)+1:INPUT" ",DT$ 723 IF DT$="" THEN 330 725 I=INSTR(DT$,"/"):IF I=0 THEN GOSUB 5200:GOTO 720 730 J=INSTR(I+1,DT$,"/"):IF J=0 THEN GOSUB 5200:GOTO 720 735 M=VAL(LEFT$(DT$,I-1)):D=VAL(MID$(DT$,I+1,J-1)):Y=VAL(MID$(DT$,J+1)):IF Y<80 OR Y>99 THEN GOSUB 5300:GOTO 720 740 IF M<1 OR M>12 THEN GOSUB 5300:GOTO 720 745 IF D<1 OR D>DAYS(M) THEN GOSUB 5300:GOTO 720 750 DT=INT((Y*10000)+(M*100)+D) 755 V1=0:CHG=O:FOR I=1 TO B:IF DT=DTS(I) THEN V1=I 760 NEXT I:IF V1=0 THEN 1000 765 CLS:PRINT TAB(23)"EDIT STOCK PRICES FOR: "DT$:PRINT 767 F$="####.###":FOR I=1 TO 10 :PRINT:PRINT I;NM$(I);:IF FL(I,V1)>0 THEN PRINT TAB(17);:PRINT USING F$;FL(I,V1); 769 PRINT TAB(27)I+10;NM$(I+10);:IF FL(I+10,V1)>0 THEN PRINT TAB(43);:PRINT USING F$;FL(I+10); 771 PRINT TAB(55)I+20;NM$(I+20);:IF FL(I+20,V1)>0 THEN PRINT TAB(71);:PRINT USING F$;FL(I+20) 772 NEXT I 773 LOCATE 15,20,0:PRINT SPACE$(50):LOCATE 15,20:PRINT"SELECT STOCK TO BE EDITED:";:J1=POS(V)+1:LOCATE ,,1:INPUT" ",AN$ 775 IF AN$="" THEN IF CHG=0 THEN 330 ELSE 2900 780 V2=VAL(AN$):IF V2<0 OR V2>A THEN GOSUB 5500:GOTO 773 785 LOCATE 17,20,0:PRINT SPACE$(50):LOCATE 17,20,0:PRINT "EDIT FOR SPLIT (Y/N)? ";:LOCATE ,,1:GOSUB 5400 795 IF AN$="N" OR AN$="n" THEN 900 800 LOCATE 19,10:PRINT SPACE$(65):LOCATE 19,10:PRINT"ENTER SPLIT FACTOR USING A COMMA (E.G. 3 FOR 2 AS 3,2): ";:J1=POS(V):LOCATE ,,1:LINE INPUT AN$ 805 IF AN$="" THEN LOCATE 19,10:PRINT SPACE$(60):GOTO 785 810 I=INSTR(AN$,","):IF I=0 THEN GOSUB 5200:GOTO 800 815 F1=VAL(LEFT$(AN$,I-1)):F2=VAL(MID$(AN$,I+1)) 820 LOCATE 21,10:PRINT "CONFIRM SPLIT: ";F1;" FOR ";F2;" (Y/N): ";:LOCATE ,,1:GOSUB 5400 830 IF AN$="N" OR AN$="n" THEN LOCATE 21,30:PRINT SPACE$(40):LOCATE 19,10:PRINT SPACE$(60):GOTO 800 835 CHG=1:FOR I=V1 TO 1 STEP-1:FL(V2,I)=FL(V2,I)*(F2/F1):NEXT I:GOTO 765 900 LOCATE 19,20:PRINT"ENTER NEW PRICE FOR ";NM$(V2);":";:LOCATE ,,1:INPUT" ",AN$:IF AN$="" THEN LOCATE 19,20,0:PRINT SPACE$(50):LOCATE 17,20:PRINT SPACE$(50):GOTO 773 905 CHG=1:IF VAL(AN$)<0 THEN FL(V2,V1)=0 ELSE FL(V2,V1)=VAL(AN$) 910 GOTO 765 1000 LOCATE 6,15:PRINT"CONFIRM: NEW PRICE DATA (Y/N)? ";:LOCATE ,,1:GOSUB 5400 1010 IF AN$="N" OR AN$="n" THEN 710 1015 FOR I=1 TO B:IF DT>DTS(I) THEN V1=I 1020 NEXT I:IF V1=0 AND B=52 THEN LOCATE 8,20:PRINT"DATE TOO EARLY; WOULD DESTROY LATEST DATA":FOR J=1 TO 1500:NEXT J:GOTO 710 1025 IF B=52 THEN FOR J=1 TO V1-1:DTS(J)=DTS(J+1):FOR I=1 TO A:FL(I,J)=FL(I,J+1):NEXT J,I:GOTO 1035 1030 B=B+1:V1=V1+1:IF V1<B THEN FOR J=B-1 TO V1 STEP-1:DTS(J+1)=DTS(J):FOR I=1 TO A:FL(I,J+1)=FL(I,J):NEXT I,J 1035 CLS:PRINT TAB(25)"ENTERING NEW PRICES FOR ";DT$:PRINT:FOR I=1 TO A:PRINT TAB(30) NM$(I);":";:LOCATE ,,1:INPUT" ",AN$ 1040 IF VAL(AN$)<0 THEN FL(I,V1)=0 ELSE FL(I,V1)=VAL(AN$) 1045 NEXT I:DTS(V1)=DT:GOTO 2900 1100 REM ----- Graph Stocks 1110 CLS:LOCATE ,,0:COLOR 14,0:PRINT TAB(30)"PERFORMANCE GRAPHS":COLOR 7,0:PRINT:PRINT 1120 IF B=0 THEN GOSUB 5100:GOTO 330 1180 PRINT"GRAPH LEGEND: PRICES = VERTICAL LINES MOVING AVE = HORIZONTAL *":GOSUB 4100 1200 PRINT:COLOR 14,0:PRINT TAB(10)"ENTER # TO BE GRAPHED (<RETURN> TO EXIT):";:J1=POS(V)+1:LOCATE ,,1:INPUT" ",AN$:IF AN$="" THEN 330 1210 X=VAL(AN$):IF X<1 OR X>A THEN GOSUB 5500:GOTO 1200 1220 CLS:COLOR 7,0:K1=FL(X,1):K2=K1 1230 FOR J=1 TO B:IF FL(X,J)<>0 AND K1>FL(X,J) THEN K1=FL(X,J) 1240 IF FL(X,J)<>0 AND K2<FL(X,J) THEN K2=FL(X,J) 1250 NEXT J:K1=INT(K1):K2=INT(K2+1) 1254 FOR I=1 TO B:IF FL(X,I)=0 THEN NEXT I 1256 FOR J=B TO 1 STEP-1:IF FL(X,J)=0 THEN NEXT J 1258 DT1$=STR$(DTS(I)):DT1$=MID$(DT1$,4,2)+"/"+RIGHT$(DT1$,2)+"/"+MID$(DT1$,2,2) 1260 DT2$=STR$(DTS(J)):DT2$=MID$(DT2$,4,2)+"/"+RIGHT$(DT2$,2)+"/"+MID$(DT2$,2,2) 1265 PRINT "STOCK: ";NM$(X);:PRINT TAB(25)"FIRST PRICE: ";DT1$;" LAST PRICE: ";DT2$ 1270 K3=INT(((K2-K1)/18)+0.99) 1280 PRINT:FOR I=K1+17*K3 TO K1-K3 STEP-K3:PRINT I:NEXT '----- Graph Scale 1290 FOR J=1 TO B:IF FL(X,J)=0 THEN Y2(J)=0:GOTO 1310 1300 Y2(J)=INT(((FL(X,J)-K1)/K3)+1) '----- Calc. Vert. Line 1310 NEXT J:LOCATE 22,4 1320 FOR J=1 TO B:IF Y2(J) THEN FOR I=21 TO 21-Y2(J) STEP-1:LOCATE I,5+J:PRINT CHR$(221):NEXT I 1330 NEXT J 1340 FOR J=5 TO B:Y2(J)=0:IF FL(X,J)=0 THEN 1380 1350 FOR I=J-1 TO J-4 STEP-1:IF FL(X,I)=0 THEN 1380 1360 NEXT I:MAV(J)=0:FOR I=J TO J-4 STEP-1:MAV(J)=MAV(J)+FL(X,I):NEXT I:MAV(J)=MAV(J)/5 1370 Y2(J)=INT(20-((MAV(J)-K1)/K3)+1) '----- Calc. Line 1380 NEXT J 1390 FOR J=5 TO B:IF Y2(J)>0 THEN XX=5+J:LOCATE Y2(J),XX:PRINT"*" 1400 NEXT J:LOCATE 22,1:COLOR 14,0:PRINT" 1234567890123456789012345678901234567890123456789012 -- Periods" 1410 PRINT" 1 2 3 4 5 " 1465 COLOR 7,0:PRINT"Enter (G) for another graph; (ESC) to return to menu or PrtSc to print"; 1470 AN$=INKEY$:IF AN$="" THEN 1470 ELSE IF ASC(AN$)<>27 THEN 1110 1475 GOTO 330 1480 REM ----- High-Low-Last 1490 CLS:LOCATE ,,0:COLOR 14,0:PRINT TAB(30)"HI-LOW-LAST PRICES":COLOR 7,0:PRINT:PRINT 1495 IF B=0 THEN GOSUB 5100:GOTO 330 1500 PRINT"STOCK HI LOW LAST |STOCK HI LOW LAST" 1510 PRINT:Y=0:FOR I=1 TO 15:LST=0:LST2=0:HFL2=0:HFL=0:LFL=FL(I,1):LFL2=FL(I+15,1) 1520 FOR J=1 TO B:IF FL(I,J)>HFL THEN HFL=FL(I,J) 1530 IF FL(I+15,J)>HFL2 THEN HFL2=FL(I+15,J) 1540 IF FL(I,J)<=LFL AND FL(I,J)>0 THEN LFL=FL(I,J) 1550 IF FL(I+15,J)<=LFL2 AND FL(I+15,J)>0 THEN LFL2=FL(I+15,J) 1560 IF FL(I,J)>0 THEN LST=FL(I,J) 1570 IF FL(I+15,J)>0 THEN LST2=FL(I+15,J) 1580 NEXT J:COLOR 7,0:Y=1-Y:IF Y THEN COLOR 14,0 1590 F$="####.###":IF NM$(I)<>"" THEN PRINT LEFT$(NM$(I),10);:PRINT TAB(13);:PRINT USING F$;HFL;:PRINT TAB(22);:PRINT USING F$;LFL;:PRINT TAB(31);:PRINT USING F$;LST;:PRINT TAB(40)"|"; 1600 IF NM$(15+I)<>"" THEN PRINT TAB(41) LEFT$(NM$(15+I),10);:PRINT TAB(53);:PRINT USING F$;HFL2;:PRINT TAB(62);:PRINT USING F$;LFL2;:PRINT TAB(71);:PRINT USING F$;LST2 ELSE PRINT 1610 NEXT I 1615 COLOR 7,0 1616 LOCATE 23,1,1:PRINT "PRESS ANY KEY TO RETURN TO MENU."; 1620 AN$=INKEY$:IF AN$="" THEN 1620 ELSE 330 1640 REM ----- Print Price History 1650 CLS:LOCATE ,,0:COLOR 14,0:PRINT TAB(30)"STOCK PRICE HISTORY":COLOR 7,0:PRINT:IF B=0 THEN PRINT:GOSUB 5100:GOTO 330 1653 GOSUB 4100:PRINT:PRINT 1655 ISTK=0:PRINT TAB(12)"ENTER SELECTION (<ENTER> FOR ALL, 0 TO EXIT): ";:J1=POS(V):LOCATE ,,1:LINE INPUT AN$ 1657 IF AN$="0" THEN 330 1660 IF AN$="" THEN ISTK=A:FOR I=1 TO A:ISTKN(I)=I:NEXT I:GOTO 1700 1665 I=INSTR(AN$,"-"):IF I=0 THEN 1680 1670 V1=VAL(LEFT$(AN$,I-1)):V2=VAL(MID$(AN$,I+1)) 1675 IF V1<1 OR V1>A OR V2<1 OR V2>A OR V1>V2 THEN GOSUB 5500:GOTO 1655 ELSE ISTK=V2-V1+1:FOR I=V1 TO V2:ISTKN(I-V1+1)=I:NEXT I:GOTO 1700 1680 I=INSTR(AN$,","):IF I=0 THEN 1695 1685 V1=1:WHILE V1<=LEN(AN$):V2=VAL(MID$(AN$,V1,I-V1)):IF V2<1 OR V2>A THEN GOSUB 5500:GOTO 1655 ELSE ISTK=ISTK+1:ISTKN(ISTK)=V2 1690 V1=I+1:I=INSTR(V1,AN$,","):IF I=0 THEN I=LEN(AN$)+1: 1693 WEND:GOTO 1700 1695 V1=VAL(AN$):IF V1<1 OR V1>A THEN GOSUB 5500:GOTO 1655 ELSE ISTK=1:ISTKN(1)=V1 1700 PRINT:PRINT TAB(17)"READY PRINTER. PRESS ANY KEY TO START." 1705 AN$=INKEY$:IF AN$="" THEN 1705 1710 F$="#######.###":V1=INT(ISTK/5):VST=1:IF V1=0 THEN 1720 1715 FOR I=1 TO V1:VST=((I-1)*5)+1:VFIN=VST+4:GOSUB 1800:LPRINT CHR$(12):NEXT I:VST=VST+5 1720 IF VST<=ISTK THEN VFIN=ISTK:GOSUB 1800 1730 GOTO 330 1800 LPRINT:LPRINT TAB(30)"STOCK PRICE HISTORY":LPRINT:LPRINT 1805 FOR J=VST TO VFIN:VL(J)=LEN(NM$(ISTKN(J))):LPRINT TAB((J-VST)*14+10)SPACE$((14-VL(J))/2-0.5);NM$(ISTKN(J));:NEXT J:LPRINT 1810 FOR J=VST TO VFIN:LPRINT TAB((J-VST)*14+10)SPACE$((14-VL(J))/2-0.5);STRING$(VL(J),"-");:NEXT J:LPRINT 1815 FOR J=1 TO B:DT1$=STR$(DTS(J)):DT1$=MID$(DT1$,4,2)+"/"+RIGHT$(DT1$,2)+"/"+MID$(DT1$,2,2):LPRINT DT1$; 1820 LPRINT TAB(10);:FOR J1=VST TO VFIN:LPRINT USING F$;FL(ISTKN(J1),J);:LPRINT SPACE$(3);:NEXT J1:LPRINT:NEXT J:LPRINT:RETURN 2020 REM ----- Buy/Sell Evaluation Routine 2030 CLS:LOCATE ,,0:COLOR 14,0:PRINT TAB(27)"STOCK BUY/SELL ANALYSIS":COLOR 7,0:PRINT:PRINT 2040 IF B=0 THEN GOSUB 5100:GOTO 330 2050 FOR I=1 TO A:LOCATE 4,29:PRINT"ANALYZING STOCK # "I:FOR J=1 TO B:IF FL(I,J)>0 THEN LST(I)=FL(I,J) 2080 NEXT J 2090 Y1=0:FOR J=1 TO B:IF FL(I,J)=0 THEN 2110 '----- Calc. Slope 2100 Y1=Y1+1:Y2(Y1)=J 2110 NEXT J:SUMY=0:XY=0 2120 FOR J=1 TO Y1:XY=XY+J*FL(I,Y2(J)):SUMY=SUMY+FL(I,Y2(J)):NEXT J 2130 IF Y1>1 THEN SLOPE(I)=(XY-SUMY*(Y1/2))/10 2140 IF Y1>0 THEN MEAN(I)=SUMY/Y1 2150 IF Y1<5 THEN MX=2:MY=2:GOTO 2385 2200 FOR J=1 TO Y1:SUMSQR=SUMSQR+(MEAN(I)-FL(I,Y2(J)))^2 2210 NEXT J:SDEV(I)=SQR(SUMSQR)/(Y1-1):BETA(I)=INT((SDEV(I)/MEAN(I))*1000):MX=2:MY=2 2320 DIF=LST(I)-MEAN(I):IF DIF>2*SDEV(I) THEN MY=3:GOTO 2350 2330 IF DIF<-2*SDEV(I) THEN MY=1:GOTO 2350 2340 MY=2 2350 IF SLOPE(I)>SDEV(I) THEN MX=3:GOTO 2380 2360 IF SLOPE(I)<-SDEV(I) THEN MX=1:GOTO 2380 2370 MX=2 2380 IF MX=3 AND MY=3 AND LST(I)-MEAN(I)>4*SDEV(I) THEN MX=2 2385 ACT$(I)=SB$(MX,MY) 2390 NEXT I 2400 LOCATE 4,1,0:COLOR 14,0:PRINT"STOCK NAME ACTION AVE. PRICE LAST PRICE DELTA" 2405 PRINT"---------- ------ ---------- ---------- -----" 2410 FOR I=1 TO A:IF ACT$(I)="SELL" THEN COLOR 20,0 2420 IF ACT$(I)="BUY" THEN COLOR 18,0 2440 PRINT NM$(I)TAB(22); 2442 IF Y1=0 THEN PRINT"NO PRICES":GOTO 2450 2444 PRINT ACT$(I)TAB(42)MEAN(I)TAB(59);: 2446 PRINT USING"####.###";LST(I);:PRINT TAB(72); 2448 IF Y1>4 THEN PRINT USING"##.##";BETA(I)/10 ELSE PRINT " NA" 2450 COLOR 7,0:IF I<>15 THEN 2460 2453 COLOR 14,0:PRINT:PRINT"PRESS ANY KEY TO CONTINUE.";:LOCATE ,,1:COLOR 7,0 2455 AN$=INKEY$:IF AN$="" THEN 2455 ELSE LOCATE CSRLIN-1,1,0 2460 NEXT I 2490 PRINT:PRINT"PRESS ANY KEY FOR MENU.";:LOCATE ,,1 2500 AN$=INKEY$:IF AN$="" THEN 2500 ELSE 330 2715 REM ----- Sorting Routine 2720 LOCATE 23,25,0:PRINT SPACE$(45);:LOCATE ,30:IF A=0 THEN GOSUB 5000:GOTO 330 ELSE COLOR 30,0:PRINT"SORTING"; 2730 FOR I=1 TO A-1:FOR J=I+1 TO A:IF RIGHT$(NM$(I),2)<=RIGHT$(NM$(J),2) THEN 2760 2740 SWAP NM$(I),NM$(J) 2750 FOR Z=1 TO B:SWAP FL(I,Z),FL(J,Z):NEXT Z 2760 NEXT J,I 2770 FOR I=1 TO A-1:FOR J=I+1 TO A 2775 IF (RIGHT$(NM$(I),2)=RIGHT$(NM$(J),2) AND RIGHT$(NM$(I),1)=")" AND NM$(I)<=NM$(J)) OR (RIGHT$(NM$(I),1)<>")" AND RIGHT$(NM$(J),1)<>")" AND NM$(I)<=NM$(J)) THEN 2800 2780 SWAP NM$(I),NM$(J) 2790 FOR Z=1 TO B:SWAP FL(I,Z),FL(J,Z):NEXT Z 2800 NEXT J,I:LOCATE 23,30,0:COLOR 14,0:PRINT"SORT COMPLETE";:FOR I=1 TO 1500:NEXT I:LOCATE ,30:PRINT SPACE$(20):LOCATE ,1:GOTO 2900 2900 REM ----- Save Updated Data To Disk 2910 COLOR 30,0:PRINT TAB(30)"SAVING DATA";:ON DTA GOTO 2915,2920,2925 2915 OPEN "DATA1" FOR OUTPUT AS #1:GOTO 2930 2920 OPEN "DATA2" FOR OUTPUT AS #1:GOTO 2930 2925 OPEN "DATA3" FOR OUTPUT AS #1 2930 PRINT#1,A;B 2935 FOR I=1 TO A:PRINT#1,NM$(I):NEXT I 2940 IF B>0 THEN FOR I=1 TO B:PRINT#1,DTS(I):NEXT I 2945 IF B>0 THEN FOR I=1 TO A:FOR J=1 TO B:PRINT#1,FL(I,J):NEXT J,I 2950 CLOSE:GOTO 330 3000 REM ----- End Routine 3010 KEY 1,"LIST ":KEY 2,"RUN"+CHR$(13):KEY 3,"LOAD"+CHR$(34):KEY 4,"SAVE"+CHR$(34):KEY 5,"CONT"+CHR$(13):KEY 6,","+CHR$(34)+"LPT1:"+CHR$(34)+CHR$(13):KEY 7,"TRON"+CHR$(13):KEY 8,"TROFF"+CHR$(13):KEY 9,"KEY " 3020 KEY 10,"SCREEN "+CHR$(0)+","+CHR$(0)+","+CHR$(0)+CHR$(13):CLS:KEY ON:END 3500 REM ----- Data Section 3510 DATA CONSIDER A BUY,CONSIDER A SELL,SELL,BUY,NO ACTION,SELL,BUY,CONSIDER A BUY,CONSIDER A SELL 3520 DATA 31,29,31,30,31,30,31,31,30,31,30,31 4000 REM ----- Subroutines 4100 PRINT:FOR I=1 TO 10 :PRINT TAB(5)I;NM$(I)TAB(30)I+10;NM$(I+10)TAB(55)I+20;NM$(I+20):NEXT I:RETURN 4200 A=0:B=0:FOR I=1 TO 30:NM$(I)="":ACT$(I)="":FOR J=1 TO 52:FL(I,J)=0:NEXT J,I:FOR I=1 TO 52:DTS(I)=0:NEXT:RETURN 5000 PRINT TAB(30)"NO STOCKS IN LIST":FOR I1=1 TO 1500:NEXT I1:RETURN 5100 PRINT TAB(30)"NO PRICES IN LIST":FOR I1=1 TO 1500:NEXT I1:RETURN 5200 PRINT TAB(40)"INVALID FORMAT";:FOR I1=1 TO 1500:NEXT I1:I1=CSRLIN-1:LOCATE ,40,0:PRINT SPACE$(20);:LOCATE I1-1,J1:PRINT SPACE$(20);:RETURN 5300 PRINT TAB(40)"INVALID DATE";:FOR I1=1 TO 1500:NEXT I1:I1=CSRLIN-1:LOCATE ,40,0:PRINT SPACE$(20);:LOCATE I1,J1:PRINT SPACE$(20);:LOCATE ,1,1:RETURN 5400 AN$=INKEY$:IF AN$="" THEN 5400 ELSE J1=POS(V) 5410 IF ASC(AN$)<>13 THEN PRINT AN$; 5420 IF AN$="Y" OR AN$="y" OR AN$="N" OR AN$="n" THEN 5440 5430 LOCATE ,,0:PRINT TAB(35)"Y OR N PLEASE";:FOR I1=1 TO 1000:NEXT I1:I1=CSRLIN-1:LOCATE ,35:PRINT SPACE$(20);:LOCATE I1,J1:PRINT " ";:LOCATE ,J1,1:GOTO 5400 5440 RETURN 5500 PRINT TAB(30)"BAD SELECTION";:FOR I1=1 TO 1500:NEXT I1:I1=CSRLIN-1:LOCATE ,30,0:PRINT SPACE$(20);:LOCATE I1,J1,0:PRINT SPACE$(10);:LOCATE ,1,1:RETURN