I have had success plotting delta, theta and gamma against the underlying asset price, as in the following program:
Code: Select all
smpl 30 70
*
* calculate BSM price
*
@BSOPTION(price=49,strike=50,rate=0.05,sigma=0.2,expire=0.3846) bsm
dis "BSM price is" bsm
*
* calculate and plot BSM prices for a range of asset prices
*
compute strike=50
compute rate=0.05
compute sigma=0.2
compute cashflow=0
compute expire=0.3846
set s = t
clear d11
clear d22
clear value
* plot of call option premium against asset price
do i=30,70
compute d11(i)=(log(s(i)/strike)+expire*(rate-cashflow+.5*sigma**2))/(sigma*sqrt(expire))
compute d22(i)=d11(i)-sigma*sqrt(expire)
compute value(i)=s(i)*exp(-cashflow*expire)*%cdf(d11(i))-strike*exp(-rate*expire)*%cdf(d22(i))
end do i
graph(style=line,header="Call option premium and asset price (in $)",vlabel="Call option premium",hlabel="Asset price") $
1
# value
*
* calculate and plot delta against asset prices
*
clear calldelta
clear putdelta
do i=30,70
compute calldelta(i)=%cdf(d11(i))
compute putdelta(i)=%cdf(d11(i))-1
end do i
graph(height=%cm(15),width=%cm(12),style=line,header="Call option delta and asset price",vlabel="Call option delta",hlabel="Asset price") $
1
# calldelta
graph(height=%cm(15),width=%cm(12),style=line,header="Put option delta and asset price",vlabel="Put option delta",hlabel="Asset price") $
1
# putdelta
*
* calculate and plot thetas for puts and calls against asset prices
*
clear calltheta
clear puttheta
do i=30,70
compute calltheta(i)=-(49*%density(d11(i))*sigma)/(2*sqrt(expire))-(rate*strike*exp(-rate*expire))*%cdf(d22(i))
compute puttheta(i)=-(49*%density(d11(i))*sigma)/(2*sqrt(expire))+(rate*strike*exp(-rate*expire))*%cdf(-d22(i))
end do i
graph(style=line,key=attached,klabel=||"Call","Put"||,header="Thetas and asset price",vlabel="Option Thetas",hlabel="Asset price") $
2
# calltheta
# puttheta
*
* calculate and plot gamma for puts and calls against asset prices
*
clear callputgamma
do i=30,70
compute callputgamma(i)=(%density(d11(i)))/(49*sigma*sqrt(expire))
end do i
graph(style=line,header="Gamma (for puts and calls) and asset price",vlabel="Option Gammma",hlabel="Asset price") $
1
# callputgamma