If this program works with no problems, then I guess I don't need to change my ways.. A text based version of this would probably cut the size of code to minimal.
Tell me if there is a problem with this program working on the web based BBCSDL.. I use this program and others like it every day for trading.
( I am sharing the link so that non programmers that trade with me can use it.. They have seen it in action )
Code: Select all
REM Stock trader share calculator 3 ranges (July 17,2020)
REM ************* BEGINNING OF USER AREA (modify for your stock) ******************
LET money=0:REM you can put a default value here but you can just edit within the active app
INPUT "PLAY AMOUNT ? ";money
LET low=2.30: REM replace this number with the lowest your stock is likely to go
LET high=2.45: REM replace this number with the highest your stock is likely to go
LET bought=2.32: REM this will be your current stock purchase (static)
name$="POU": REM replace this with your stock name
LET bf=10: REM <<<<< Your Banking fee per transaction ***
REM ************************************ END OF USER INFO AREA ********************
money2=0
nde%=0
bres=0:REM bought shares value
lres=0:REM low share prediction
sbou=0:REM variable for high bought cash display
dif=0:diff$=""
mx=0:my=0:mb=0
money=money-bf
PROCgraphics(280,505)
REM You must accept ALL financial risks from using this program before using it
REM The Author of this program offers no promise of profit or functionality
*REFRESH OFF
REM live adjustable low (shares needed to buy at this level)
PROCsbox(10,10,500,300,"6")
PROCsbox(10,305,500,600,"6")
PROCsbox(10,605,500,900,"6")
PROCsbox(10,905,500,1000,"6")
PROCsbox(505,10,560,900,"0")
PROCsbox(505,10,560,600,"0")
PROCsbox(505,10,560,300,"0")
GCOL 0
MOVE 10,940:PRINT " Stock Trading Tool "
GCOL 15:MOVE 20,970:PRINT name$
REPEAT
GCOL 6:MOVE 20,450:PRINT "PLAY MONEY $ "+STR$(money)
v=0
LET v= FNau(530,210)
lres= FNlsharecalc(20,200,low,money)
IF v=1 THEN
MOVE20,230:GCOL 6:PRINT STR$(low)
low=low+.01
WAIT 7
ENDIF
v=0
LET v= FNad(530,90)
IF v=1 THEN
MOVE20,230:GCOL 6:PRINT STR$(low)
low=low-.01
WAIT 7
ENDIF
GCOL 0
MOVE 20,230:PRINT STR$(low)
REM live adjustments bought location
v=0
LET v= FNau(530,495)
bres= FNsharecalc(20,520,bought,money)
IF v=1 THEN
MOVE20,550:GCOL 6:PRINT STR$(bought):nde%=money/bought/2:MOVE 20,350:PRINT "(1/2 shares) "+STR$(nde%)
bought=bought+.01
WAIT 7
ENDIF
v=0
LET v= FNad(530,390)
IF v=1 THEN
MOVE20,550:GCOL 6:PRINT STR$(bought):nde%=money/bought/2:MOVE 20,350:PRINT "(1/2 shares) "+STR$(nde%)
bought=bought-.01
WAIT 7
ENDIF
GCOL 0
MOVE 20,550:PRINT STR$(bought)
GCOL 6:MOVE 20,450:PRINT "PLAY MONEY $ "+STR$(money)
MOVE 20,350:GCOL 15:nde%=money/bought/2:PRINT "(1/2 shares) "+STR$(nde%): GCOL 0:MOVE 20,450:PRINT "PLAY MONEY $ "+STR$(money):*REFRESH
WAIT 7
REM live adjustable high location
MOVE 20,820:GCOL 6:PRINT "$ "+STR$(sbou)
MOVE 20,350:GCOL 6:PRINT "(1/2 shares) "+STR$(money/bought/2)
GCOL 6:MOVE 20,450:PRINT "PLAY MONEY $ "+STR$(money)
nnm=0
REM:nnm=FNnewcash: IF nnm>0 THEN money= nnm:bres=FNsharecalc(20,520,bought,money)
sbou=money/bought
sbou=sbou*high
v=0
MOVE 20,880:GCOL 1:PRINT"SELL POINT"
LET v= FNau(530,800)
IF v=1 THEN
MOVE20,850:GCOL 6:PRINT STR$(high)
high=high+.01
WAIT 7
ENDIF
v=0
LET v= FNad(530,690)
IF v=1 THEN
MOVE20,850:GCOL 6:PRINT STR$(high)
high=high-.01
WAIT 7
ENDIF
MOVE 20,820:GCOL 0:PRINT "$ "+STR$(sbou)
GCOL 0
MOVE 20,850:PRINT STR$(high)
GCOL 1
MOVE 20,790
PRINT"*** CHANGE ***"
GCOL 6
MOVE 20,760:PRINT "$ "+diff$
IF sbou>money THEN dif=sbou-money:diff$=STR$(dif)
IF sbou<money THEN dif=money-sbou:diff$="-"+STR$(dif)
GCOL 0
MOVE 20,760:PRINT "$ "+diff$
WAIT 5
UNTIL FALSE
*REFRESH ON
END
DEF FNnewcash
LOCAL x,y,b,p,money2
MOUSE x,y,b
MOVE 20,400:GCOL 12: PRINT"CHANGE PLAY MONEY"
IF x>20 AND y>370 AND x<300 AND y<410 THEN
MOVE 20,400:GCOL 15:PRINT"CHANGE PLAY MONEY"
IF b=4 THEN money2=VAL(FNinput(20,400,25))-10
ENDIF
=money2
REM remember this allows input message to be completed before it cycles.
REM this command takes control until message is entered.
REM I am working on a more flexible version that can be left and revisited like in windows
REM so sorta like live multi processes
REM H,V,TEXTLIMIT (simpler?)
DEF FNinput(bx,by,textlimit)
LOCAL fill,MESSAGE$
initialx%=0:sl%=0:key$="":MESSAGE$="":MES$=""
initialx%=textlimit*16.2
FOR fill=1 TO 58
GCOL 15:LINE bx-4,by+20-fill,bx+initialx%,by+20-fill
NEXT fill
GCOL 0:LINE bx+3,by+20,bx+initialx%,by+20:LINE bx+3,by+20-fill,bx+initialx%,by+20-fill
REPEAT
REPEAT
key$ =INKEY$(1)
GCOL 0
MOVE bx,by:PRINT MESSAGE$;"_" :* REFRESH
sl%=LEN(MESSAGE$)
UNTIL key$ <>""
sl%=LEN(MESSAGE$)
IF INKEY(-48) sl%=LEN(MESSAGE$)-1:key$=""
REPEAT UNTIL INKEY(0)=-1
IF sl%<LEN(MESSAGE$) THEN
GCOL 15
MOVE bx,by
PRINT MESSAGE$;"_"
ENDIF
MES$=MID$(MESSAGE$,0,sl%)
MESSAGE$=MES$
GCOL 15:MOVE bx,by:PRINT MESSAGE$;"_"
IF LEN(key$) = 1 THEN
IF LEN(MESSAGE$)<textlimit THEN GCOL 15:MOVE bx,by:PRINT MESSAGE$;"_": MESSAGE$=MESSAGE$+key$:* REFRESH OFF
REM (jump)
ENDIF
UNTIL INKEY(-74)
=MESSAGE$
REM low buy shares predict
DEFFNlsharecalc(x,y,p,cash)
PRIVATE oldres%
LOCAL result%
MOVE x,y
result%=cash/p
GCOL 6
PRINT STR$(oldres%)+" shares"
GCOL 0
MOVE x,y
PRINT STR$(result%)+" shares"
oldres%=result%
=result%
REM bought
DEFFNsharecalc(x,y,p,cash)
PRIVATE oldres%
LOCAL result%
MOVE x,y
result%=cash/p
GCOL 6
PRINT STR$(oldres%)+" shares"
GCOL 0
MOVE x,y
PRINT STR$(result%)+" shares"
oldres%=result%
=result%
REM arrowup function
DEF FNau(x,y)
LOCAL c
MOUSE mx,my,mb
IF mx>x-20 AND mx<x+10 AND my>y AND my<y+50 THEN c=15 ELSE c=7
PROCarrowup(x,y,c)
IF c=15 AND mb=4 THEN =1
=0
DEF FNad(x,y)
LOCAL c
MOUSE mx,my,mb
IF mx>x-20 AND mx<x+10 AND my>y-30 AND my<y+15 THEN c=15 ELSE c=7
PROCarrowdown(x,y,c)
IF c=15 AND mb=4 THEN =1
=0
REM lets stick with 16 colors **********************************************************************
DEF PROCsbox(x%,y%,w%,h%,c$)
LOCAL ry%,sx%,sy%
sx%=x%:sy%=y%
IF x%>w% THEN x%=w%:w%=sx%
IF y%>h% THEN y%=h%:h%=sy%
ry%=y%
GCOL VAL(c$)
REPEAT
LINE x%,y%,w%,y%
y%=y%+1
UNTIL y%=h%
y%=ry%
IF c$<>"0" THEN GCOL 0 ELSE GCOL 15
LINE x%+2,y%+2,w%-2,y%+2
LINE w%-2,y%+2,w%-2,h%-4
LINE w%-2,h%-4,x%+2,h%-4
LINE x%+2,h%-4,x%+2,y%+2
ENDPROC
DEF PROCgraphics(x,y)
VDU 23,22,x;y;8,15,16,1
VDU 5
ENDPROC
DEFPROCarrowup(x,y,c)
LOCAL ax,aw
GCOL c
FOR ax=1 TO 20
PROCLR(x,y+ax,10)
NEXT ax
ax=0:aw=20
FOR ax=1 TO 20
PROCLR(x,y+20+ax,aw)
aw=aw-1
NEXT ax
ENDPROC
DEFPROCarrowdown(x,y,c)
LOCAL ax,aw
GCOL c
FOR ax=1 TO 20
PROCLR(x,y-ax,10)
NEXT ax
ax=0:aw=20
FOR ax=1 TO 20
PROCLR(x,y-20-ax,aw)
aw=aw-1
NEXT ax
ENDPROC
REM Left and Right from center x,y, and width w
DEFPROCLR(x,y,w)
LINE x-w,y,x+w,y
ENDPROC