The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
A new challenge in the HP19BII solver for the MOHPC community!!
01-09-2015, 03:35 PM
Post: #1
A new challenge in the HP19BII solver for the MOHPC community!!
Dear MOHPC-Community!

Here I am again to bother you!-
Last week I couldn’t believe my eyes; I submitted to your attention a code for programming a call formula out of a finance book and Bill and Gerson discovered an error in the edited book in less than an hour!! - AMAZING..
I have already written to the publisher to notify the error and hopefully the 3rd edition will come out correctly…

Now I have a similar and related problem on HP19BII

Wanting to calculate the Black-Scholes version of the formulas for calls and Puts

C=SxN(d1)-XxEXP(-RxT)xN(d2) with

d1=((LN((SxX^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))
d2=((LN((SxX^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5)) -oxT^.5

P=XxEXP(-RxT)xN(-d2)-SxN(-d1)

and using an approximation of the Normal distribution according to Zelen and Severo (1964) as follows:

Ν=1-(((2xPΙ)^-.5xEXP((-Y^2)÷2))x((.4361836x(1+.33267xΥ)^-1+(-.1201676)x(1+.33267xΥ)^-2
+.9372980x(1+.33267xΥ)^-3)))

substituting one gets these results for call and put:

CALL=Sx(1-(((2xPI)^-.5)xEXP(-((LN((Sx(X^-
1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5)))^2÷2))x(.4361836x((1+(.33267x(LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))))^-1)+(-.1201676)x((1+(.33267x(LN((Sx(X^-
1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))))^-2)+.9372980x((1+(.33267x(LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))))^-3)))-
XxEXP(-RxT)x
(1-(((2xPI)^-.5)xEXP(-((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)^2÷2))x
(.4361836x((1+(.33267x((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)))^-1)
+(-.1201676)x((1+(.33267x((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5 )+(.5xoxT^.5))-oxT^.5)))^-2)
+.9372980x((1+(.33267x((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)))^-3)))

********************************************************************************​*****************************

PUT=XxEXP(-RxT)x((1-(((2xPI)^-.5)xEXP(-((LN((Sx(X^-
1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)^2÷2))x(.4361836x((1+(.33267x((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)))^-1)+(-.1201676)x((1+(.33267x((LN((Sx(X^-
1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)))^-2)+.9372980x((1+(.33267x((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))-oxT^.5)))^-3))))-
Sx(1-(1-(((2xPI)^-.5)xEXP(-((LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5)))^2÷2))x
(.4361836x((1+(.33267x(LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))))^-1)
+(-.1201676)x((1+(.33267x(LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5 )+(.5xoxT^.5))))^-2)
+.9372980x((1+(.33267x(LN((Sx(X^-1xEXP(RxT))))÷(oxT^.5)+(.5xoxT^.5))))^-3))))

Where S=Spot price, X=Strike, R=interest rate, T=Time to maturity, o=Standard deviation

These formulas used to work well in the past …now after a battery change where all the solver’s content got lost ;-)) I re-inputted both both they deliver fully uncorrected results…My HPBii seems still to work…What happened? Did I do some input mistake with the brackets? Maybe other formulas in the solver with similar variables “contaminate“ those for Black and Scholes?...What do you thinK?...Regards!!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A new challenge in the HP19BII solver for the MOHPC community!! - Aconzio - 01-09-2015 03:35 PM



User(s) browsing this thread: 1 Guest(s)