1000 rem aaii program no. 8 -- crossover point 1010 rem by robert osterlund of aaii. (c) copyright 1986 by 1020 rem the american association of individual investors, 1030 rem 612 n. michigan ave., chicago, il 60611, (312)280-0170. 1040 rem from the march 1986 issue of computerized investing. 1100 rem enter dates as follows: month (comma) day (comma) year, 1110 rem for example, december 20, 1985 is entered as: 12,20,1985 2000 rem initialization routine 2010 dim d(12), mm%(4), dd%(4), yy%(4), nd(4), f(4), v(4) 2020 for j=1 to 12: read d(j): next j 2030 data 31,28,31,30,31,30,31,31,30,31,30,31 2100 rem set the following values according to your own situation. 2110 rem set i = 0 if you don't wish to account for the time value of money. 2120 mm%(3) = 4: dd%(3) = 15: rem most likely month & day of tax payment 2130 t = 40: rem marginal tax rate, in percent 2140 i = 10: rem short-term, risk-free interest rate, in percent 2200 print chr$(26): rem clear screen 2210 print 2220 print "month & day of tax payment: "; 2230 print mid$(str$(mm%(3)),2); "/"; 2240 print mid$(str$(dd%(3)),2) 2250 print "marginal tax rate (%): "; t 2260 print "interest rate (%): "; i 3000 rem data input routine 3010 print 3020 print "what was the purchase price ($)"; 3030 input v(0) 3040 print "what is the current price ($)"; 3050 input v(1) 3060 print "what was the purchase date"; 3070 input mm%(0), dd%(0), yy%(0) 3080 print "what is today's date"; 3090 input mm%(1), dd%(1), yy%(1) 4000 rem computation routine 4010 t = t/100: i = i/100 4100 rem compute date when stock goes long-term 4110 yy%(2) = yy%(0) 4120 mm%(2) = mm%(0)+6: if mm%(2)>12 then mm%(2) = mm%(2)-12: yy%(2) = yy%(2)+1 4130 dd%(2) = dd%(0)+1: if dd%(2) > d(mm%(2)) then dd%(2) = 1: mm%(2) = mm%(2)+1 4200 rem compute dates of tax payments 4210 mm%(4) = mm%(3): dd%(4) = dd%(3) 4220 yy%(3) = yy%(1)+1 4230 yy%(4) = yy%(2)+1 4300 rem calculate discount factors 4310 i = log(1+i) 4320 for j = 1 to 4 4330 mm = mm%(j): dd = dd%(j): yy = yy%(j): gosub 6000: nd(j) = nd 4340 if j > 1 then f(j) = exp(i*(nd(1)-nd(j))/365) 4350 next j 4400 rem compute allowable price drop and crossover price 4410 a = f(2)-1+t*(f(3)-.4*f(4)-f(3)*v(0)/v(1)+.4*f(4)*v(0)/v(1)) 4420 a = a/(f(2)-.4*f(4)*t) 4430 v(2) = v(1)*(1-a) 5000 rem output routine 5010 print 5020 print "date stock will go long-term: "; 5030 print mid$(str$(mm%(2)),2); "/"; 5040 print mid$(str$(dd%(2)),2); "/"; 5050 print mid$(str$(yy%(2)),2) 5060 print "allowable price drop (%): "; int(a*10000+.5)/100 5070 print "crossover point ($): "; int(v(2)*100+.5)/100 5080 print: print 5090 end 6000 rem subroutine to compute the number of days from feb 28, 1700 6010 rem results are accurate from march 1, 1900 until feb 28, 2100 6020 rem adapted from the hewlett packard hp-25 applications manual 6030 if mm > 2 then mm = mm + 1: goto 6060 6040 yy = yy - 1 6050 mm = mm + 13 6060 nd = int(365.25*yy) + int(30.6*mm) + dd - 621049 6070 return