ROM Computer Magazine Archive ROM MAGAZINE ISSUE 5 — APRIL/MAY 1984

STOCK ANALYZER AND FILER
By BOB COCKROFT

    This program is a Stock Analyzer and Filer, that I made up for myself, because I was always having trouble keeping track of each one of my stocks. This program, written in BASIC, has saved me many hours of looking through pages of stock records trying to find certain stocks.
    This program is similar to the MACTODAT program in this issue, in that it saves the stock values as DATA. By positioning the cursor at the top of the screen and have it make returns, it then saves your stocks on file. When you run the program it takes a few seconds to initialize, but once its up and running, it's quite fast. The program begins with a menu of six different options. They are: E-Erase Data, D-Directory, I-Input Data, O-Output Data,S-Save Data, and L-Load Data.
    The first option:E-Erase, is one used to erase certain stocks that are no longer of interest to yourself. It then asks you the name of the stock.(each stock can only be three letters long) Once you have inputed it, searching will be printed to the screen and if it finds it, it will print, "I found it! It has been erased."The next line will then say, "What Next?" If nothing is typed in here and a RETURN is pressed,then the program will end. If you type in one of the menu commands then the program will go to the command that you typed in.
    The second option: I-Input Data, is the heart of the program. This is where all of the information on the stock is entered. If this data is entered incorrectly, then all of the data on this stock will be wrong. The first question that the program asks you is the name of the stock. This name can only be three letters long, as I said in the last paragraph. Once the stock name is entered in, the program then asks you for the market price. This is the price that the stock sells for on the market.The next question is, "What is the book price?" The book value is equal to the net assets per share of the stock. The next question then asks "Monthly Volume?" This is the amount of shares traded in a month. Then the last question is, "The amount of outstanding shares?" This means the amount of shares that are held by the public.
    The third option: O-Output Data, is where the analysis program comes into play. The program first asks you if you would like to see any stock in particular.If you say no, it will list out the first stock it has on file.If you push the space bar you can look at the rest of the stocks on file. It will first give you the name of the stock, then the market value, book value, monthly volume, outstanding shares, public interest rating, and analysis rating. The last two names you didn't type in because they were generated through your input. The first one,Public Interest Rating, is calculated by putting the monthly volume(amount of people buying the stock) over the total shares outstanding. Public Interest, in other words, is the demand for the stock. The last output-Analysis Rating,is the monthly volume over the share outstanding, multiplied by the book rate, over the market value.
    The fourth option S-Save, is where your stocks that have been entered in are saved in data statements. These Data statements are inputted into the end of the program and can be loaded into the program through the L-Load command. Also, after a person has finished entering stocks, he or she can save the data statements on disk by typing in:LIST "D:DATA",11000,B. Where B is equal to the last data line with information on it. Remember when saving something you must press break when you see the program writing out just a lot of zeros. I wish you well on the stock market, and let me know how you like the program.

9 REM * SETING UP *
10 DIM NAME(20,50),ST$(20),MAR(50)BOOK(50),VOL(50),OUT(50),TOT(50)SR$(20),SR1$(20),NAME1(20,1),NAME2(20)
13 GRAPHICS 1:COLOR 1:SETCOLOR 2,16,1 :POSITION 2,6:? #6;" STOCK ANALYZER"
14 POSITION 4,8:? #6;" AND FILER"
15 FOR Y=1 TO 50:MAR(Y)=0:BOOK(Y)=0:VOL(Y)=0:OUT(Y)=0:NEXT Y
16 FOR B=1 TO 50:FOR B1=1 TO 20:NAME(B1,B)=0:NEXT B1:NEXT B:GOTO 2000
20 GRAPHICS 1:COLOR 1:SETCOLOR 2,16,1:POSITION 2,6:? #6;" STOCK A-NALYZER"
22 POSITION 4,8:? #6;" AND FILER"
24 POSITION 6,14:? #6;"loading":POSITION 5,16:? #6;"data lines"
50 FOR Y=1 TO 50:READ D:MAR(Y)=D:NEXT Y
52 FOR Y=1 TO 50:READ D:BOOK(Y)=D:NEXT Y
54 FOR Y=1 TO 50:READ D:VOL(Y)=D:NEXT Y
56 FOR Y=1 TO 50:READ D:OUT(Y)=D:NEXT Y
58 FOR Y=1 TO 50:FOR X=1 TO 20:READ D:NAME(X,Y)=D:NEXT X:NEXT Y
75 GOTO 2000
98 REM * INPUT DATA SECTION *
99 GOTO 2000
100 GRAPHICS 0:FOR Y=1 TO 50:IF NAME(1,Y)=0 THEN 110
105 NEXT Y
110 ? "NAME OF THE STOCK?"
120 INPUT ST$
125 IF ST$="P" THEN 1000
126 IF ST$="D" THEN 2000
130 IF ST$="E" THEN 800
135 TRAP 120
140 L=LEN(ST$)
150 FOR LL=1 TO L:NAME(LL,Y)=ASC(ST$(LL)):NEXT LL
160 ? :? "The market price?"
170 INPUT A
175 MAR(Y)=A
176 IF A=0 THEN 170
180 ? :? "The book price?"
182 INPUT A1
184 BOOK(Y)=A1
190 ? :? "The monthly volume?":INPUT A2:VOL(Y)=A2
195 ? :? "The amount of outstanding shares?":INPUT A3:OUT(Y)=A3
500 GOTO 100
610 POSITION 2,P:? "POKE 842,12:GOTO 10"
799 REM * ERASE SECTION *
800 GRAPHICS 0:? :? "Which stock do you want to erase?"
805 INPUT SR$
806 TRAP 805
807 ? :? "    Searching":
810 L1=LEN(SR$):FOR L2=1 TO L1:NAME1(L2,1)=ASC(SR$(L2)):NEXT L2
830 FOR Y=1 TO 50
840 X=1
850 IF NAME1(X,1)<>NAME(X,Y) THEN 860
855 X=X+1
856 IF X<4 THEN 850
858 ? "I found it!":FOR X=1 TO 20:NAME(X,Y)=0:NEXT X:? :? "It has been erased":GOTO 880
860 NEXT Y
870 ? "SORRY! file not found"
880 ? :? "What next?"
885 INPUT SR$:IF SR$="E" THEN 800
890 IF SR$="D" THEN 2000
899 END
999 REM * OUTPUT SECTION *
1000 GRAPHICS 0
1001 ? :? "Would you like to see any particular stock?":INPUT SR$:IF SR$="N" THEN 1022
1002 TRAP 1001
1003 ? :? "What stock?":INPUT SR$:? ,"Searching":L10=LEN(SR$):FOR LL=1 TO L10:NAME2(LL)=ASC(SR$(LL)):NEXT L
1004 FOR Y=1 TO 50:X=1
1005 IF NAME2(X)<>NAME(X,Y) THEN 1009
1006 X=X+1
1007 IF X<4 THEN 1005
1008 ? "I found it!":GOTO 1022
1009 NEXT Y
1010 ? "stock not on file"
1022 Y=0
1023 Y=Y+1:FOR X=1 TO 20
1024 IF NAME(X,Y)=0 THEN 1060
1025 ? CHR$(NAME(X,Y));
1060 NEXT X
1065 ? :? "    MARKET             ";MAR(Y)
1070 ? :? "    BOOK VALUE         ";BOOK(Y)
1075 ? :? "    MONTHLY VOLUME     ";VOL(Y)
1080 ? :? "    OUTSTANDING SHARES ";OUT(Y)
1085 ? :? "    PUBLIC INTEREST RATING ";(INT((VOL(Y)/(OUT(Y)+1.0E-03))*100000))/1000;
1095 ? :? :? "    ANALYSIS RATING   ";(INT((VOL(Y)/(OUT(Y)+1.0E-03)*BOOK(Y)/(MAR(Y)+1.0E-03))*100000))/1000
1200 ? :? "--------------------------------"
1205 IF PEEK(764)=58 THEN 2000
1210 IF PEEK(764)<>33 THEN 1210
1220 IF Y<50 THEN 1023
1999 REM * DIRECTORY SECTION *
2000 GRAPHICS 0:POSITION 13,1:? "STOCK ANALYZER":POSITION 15,2
2010 ? "DIRECTORY"
2015 ? :? ,,"   PRESS"
2020 ? :? "     ERASE: E"
2030 ? "       DIRECTORY: D"
2040 ? "       SAVE: S"
2050 ? "       INPUT DATA: I"
2055 ? "       OUTPUT DATA: O"
2060 ? "       LOAD DATA LINES: L"
2100 INPUT SR$
2110 IF SR$="E" THEN 800
2120 IF SR$="S" THEN 6000
2130 IF SR$="I" THEN 100
2140 IF SR$="O" THEN 1000
2160 IF SR$="L" THEN 20
2200 GOTO 2100
2999 END
5999 REM * SAVING DATA LINES SECTION *
6000 GRAPHICS 0:POSITION 2,2:LINE=11000:FOR L=1 TO 50:TOT(L)=MAR(L):NEXT L:COUNT=1
6010 P=2
6020 X=0
6030 FOR Y=1 TO 50
6040 IF X=0 THEN POSITION 2,P:? LINE;" DATA ";
6045 IF Y=50 THEN ? TOT(Y):GOTO 6090
6050 X=X+1
6070 IF X>20 THEN ? TOT(Y):X=0:P=P+3:LINE=LINE+5:GOTO 6080
6075 ? TOT(Y);",";
6080 IF P>15 THEN X=0:GRAPHICS 0:GOTO 6100
6090 NEXT Y
6100 POSITION 2,P+3:? "POKE 842,12:GOTO 6150":GOTO 30000
6150 IF Y<50 THEN 6090
6160 COUNT=COUNT+1:IF COUNT=2 THEN 6200
6165 IF COUNT=3 THEN 6210
6170 IF COUNT=4 THEN 6220
6180 IF COUNT=5 THEN 7000
6200 GRAPHICS 0:POSITION 2,2:LINE=12000:FOR L=1 TO 50:TOT(L)=BOOK(L):NEXT L:GOTO 6010
6210 GRAPHICS 0:POSITION 2,2:LINE=13000:FOR L=1 TO 50:TOT(L)=VOL(L):NEXT L:GOTO 6010
6220 GRAPHICS 0:POSITION 2,2:LINE=14000:FOR L=1 TO 50:TOT(L)=OUT(L):NEXT L:GOTO 6010
7000 GRAPHICS 0:POSITION 2,2
7001 P=2
7005 LINE=15000
7010 ? LINE;" DATA ";
7020 FOR Y=1 TO 50
7024 FOR X=1 TO 20
7025 IF P>15 THEN P=2:END :GRAPHICS O:GOTO 5030
7026 IF X=20 THEN ? NAME(X,Y):GOT0 7029
7027 ? NAME(X,Y);:?
7029 NEXT X
7030 P=P+3
7031 LINE=LINE+5:IF P>15 THEN POSITION 2,P:? "POKE 842,12:GOTO 7040":GOTO 30000
7032 POSITION 2,P:? LINE;" DATA ";
7035 NEXT Y
7036 GOTO 8000
7040 GRAPHICS 0:P=2:POSITION 2,P:? LINE;" DATA ";:GOTO 7035
8000 END
30000 POSITION 2,0:POKE 842,13