0 REM CDC STOCK CHARTING 7/80
1 DIM B$(1),C$(1),V$(6),D$(9),S$(200),FD(50,3),D(8),R$(35),ZZ$(128),Z$(1),CD$(1),ZP$(10),X$(5),SS$(4),V(3)
2 DIM MN(11),ZZBZ$(1):FOR I=0 TO 11:READ J:MN(I)=J:NEXT I:ZZBZ$=CHR$(253)
3 DATA 1,-2,1,0,1,0,1,1,0,1,0,1
4 B$=" ":C$=",":CD$="}":V$(1,2)="D:":ZP$=",0,0,0,0,0":R$="Type Ð to print, ÒÅÔÕÒÎ to continue":? CD$:GOSUB 8960
10 OPEN #7,4,0,"K,KK"
400 GOSUB 490:? CD$:TRAP 498:OPEN #1,4,0,"D:PRTFOLIO":POSITION 4,12:? "Current portfolio is being loaded":POKE 83,39
401 GOSUB 770:? CD$:POSITION 3,5:? "  This module of STOCK CHARTING":? "allows the user to delete a stock and"
402 POSITION 2,7:? "its associated closing quotes file":? "from the user's portfolio."
403 POKE 83,37:POSITION 4,17:? "Would you like to see the current portfolio? (Y/N) ";:POKE 764,255:INPUT ZZ$
404 TRAP 40000
405 IF ZZ$="YES" OR ZZ$="Y" THEN GOSUB 470
410 ? CD$:POSITION 4,1:? "Delete a stock from the portfolio":POSITION 10,3:? "ÆÏÒÍÁÔ-STOCK"
414 POSITION 10,5:? "* INPUT EXPLANATION *":POKE 83,39
415 POSITION 3,7:? "STOCK- ticker symbol used by stock"
416 POSITION 10,8:? "exchange. Must be identical":POSITION 10,9:? "to stock definition symbol"
417 POSITION 10,11:? "$$$$$  ÃÁÕÔÉÏÎ  $$$$$":POSITION 4,13:? "This module removes the stock"
418 POSITION 2,14:? "definition data from the portfolio":POSITION 2,15:? "and the associated closing quotes":POSITION 2,16:? "file."
419 POSITION 4,18:? "Users may wish to maintain a back-":POSITION 2,19:? "up data disk in case stock data which"
420 POSITION 2,20:? "has been purged may be required at a":POSITION 2,21:? "later date.":POKE 764,255:GOSUB 476
421 ? CD$:POSITION 4,1:? "Delete a stock from the portfolio":POKE 82,3:POSITION 4,3:? "ÆÏÒÍÁÔ-STOCK"
422 POSITION 13,5:? "** EXAMPLES **":? :? :? "NSM":? "DOW":? "WCI":POKE 82,2:? 
423 POSITION 2,12:? "ÉÎÐÕÔ óôïãë ôï âå äåìåôåä æòïí ðïòô­":? "æïìéï® Åîä ÉÎÐÕÔ âù ðòåóóéîç ÒÅÔÕÒÎ"
424 ? "ïîìù®":POKE 82,3:? 
425 POKE 752,0:INPUT ZZ$:POKE 752,1:LZ=LEN(ZZ$):IF LZ=0 THEN 440
426 GOSUB 8950:IF ZSER<>0 THEN 435
428 LSP=INT(J/4)+1:FD(LSP,0)=-1
435 CRROW=PEEK(84):IF CRROW>21 THEN POSITION 3,16:? "œ":POSITION 3,CRROW-1:GOTO 435
436 GOTO 425
440 XSP=SP:FOR I=1 TO NSP:IF FD(I,0)=-1 THEN XSP=XSP-4
441 NEXT I:GOSUB 747:SP=XSP:GOSUB 470
442 ? CD$:POSITION 3,12:? "Insert STOCK CHARTING system disk":GOSUB 476
443 TRAP 445:RUN "D:STOCK"
445 TRAP 40000:IF PEEK(195)=170 THEN POKE 195,0:OPEN #7,4,0,"K:":GOTO 442
446 GOTO 499
450 GET #7,ZZKK:IF ZZKK=80 THEN TRAP 459:OPEN #5,8,0,"P:PP":GOTO 456
452 IF ZZKK<>155 THEN 450
453 RETURN 
456 DIS=PEEK(106)*256-961:FOR ZZJJ=1 TO 920:ZZJK=PEEK(DIS+ZZJJ):IF ZZJK>127 THEN ZZJK=ZZJK-128
457 IF ZZJK>95 THEN ZZJK=ZZJK-32
458 ? #5;CHR$(ZZJK+32);:NEXT ZZJJ:CLOSE #5
459 TRAP 40000:? ZZBZ$;:GOTO 450
470 GOSUB 490:? CD$:POSITION 11,1:? "CURRENT PORTFOLIO":POSITION 11,2:? "------- ---------":POKE 82,3:? 
471 SE=0:IF SP=1 THEN POSITION 10,13:? "Portfolio is empty.":GOTO 476
472 SE=0:FOR I=1 TO NSP:IF FD(I,0)<>-1 THEN ? S$(4*I-3,4*I);"  ";:SE=SE+1:IF SE=6 THEN SE=0:? 
474 NEXT I
476 POSITION 2,23:? R$;:GOSUB 450:RETURN 
477 FOR II=CB TO LZ:IF ZZ$(II,II)<>" " AND ZZ$(II,II)<>"," THEN NEXT II:GOTO 9320
478 RETURN 
480 STOP 
490 POKE 82,2:POKE 83,37:RETURN 
493 ? CD$:POSITION 3,1:? "Input daily stock closing quotes":POSITION 2,3:? "FORMAT-DATE,STOCK,VOL,HIGH,LOW,CLOSE":RETURN 
498 CLOSE #1:? CD$:IF PEEK(195)=170 THEN POSITION 4,11:? "Insert disk containing stock data":GOSUB 476:? CD$:GOTO 400
499 ? "DISK I/O ERROR ";PEEK(195):END 
712 INPUT #1;ZZ$:RETURN 
713 INPUT #1,F1,F2,F3,F4,F5:RETURN 
733 ? #3;ZZ$:RETURN 
747 ? CD$:POSITION 3,12:? "Current portfolio is being revised":FCN=4:GOSUB 8921:GOSUB 712
748 FCN=8:GOSUB 8923:? #3;XSP:GOSUB 8973:FCN=9:GOSUB 8923
749 FOR I=1 TO NSP:IF FD(I,0)=-1 THEN V$(3,6)=S$(4*I-3,4*I):GOTO 752
750 ? #3;S$(4*I-3,4*I):GOSUB 712:GOSUB 712:GOSUB 733:GOTO 755
752 GOSUB 712:GOSUB 712:GOSUB 8965
755 NEXT I:GOSUB 8971:GOSUB 8973
757 GOSUB 8966:RETURN 
770 INPUT #1,SP:NSP=INT(SP/4)
771 FOR I=1 TO NSP:INPUT #1,SS$:GOSUB 713:S$(4*I-3,4*I)=SS$:FD(I,0)=0:FD(I,1)=F1:FD(I,2)=F2:FD(I,3)=F3
772 NEXT I:GOSUB 8971:FS1=1:RETURN 
8921 OPEN #1,FCN,0,"D:PRTFOLIO":GOTO 8970
8922 OPEN #2,FCN,0,"D:STKDAT":GOTO 8970
8923 OPEN #3,FCN,0,"D:MKTUPD":GOTO 8970
8950 ZSER=0:FOR J=3 TO 6:V$(J,J)=B$:NEXT J:IF LZ>4 THEN ? "Excess ticker symbol":ZSER=1:RETURN 
8951 V$(3,LZ+2)=ZZ$
8953 FOR J=1 TO SP-4 STEP 4:IF V$(3,6)<>S$(J,J+3) THEN NEXT J:? "Ticker symbol error":ZSER=1:RETURN 
8954 RETURN 
8960 POKE 752,1:RETURN 
8963 IF PEEK(195)=170 THEN POKE 195,0:GOTO 8970
8964 GOTO 499
8965 TRAP 8963:XIO 33,#2,0,0,V$:GOTO 8970
8966 XIO 33,#1,0,0,"D:PRTFOLIO"
8968 IF XSP=1 THEN XIO 33,#3,0,0,"D:MKTUPD":GOTO 8970
8969 XIO 32,#3,0,0,"D:MKTUPD,PRTFOLIO"
8970 TRAP 40000:RETURN 
8971 CLOSE #1:GOTO 8970
8972 CLOSE #2:GOTO 8970
8973 CLOSE #3:GOTO 8970
8981 POINT #1,FD(I,1),FD(I,2):RETURN 
8982 POINT #2,FD(I,3),FD(I,4):RETURN 
