image thumbnail
from American Option Prices and the Optimal Exercise Boundary by Bram van den Broek
This demo computes American option prices and the corresponding optimal exercise boundary

FreeBoundary(S,t,V,K,type)
function Sf = FreeBoundary(S,t,V,K,type)

Sf = zeros(1,length(t));
eps_star = K*1e-5;

switch type
    case 'put'
        for j = 1:length(t)
            Sf(j) = S(find(abs(V(:,j)-K+S)< eps_star, 1, 'last'));
        end
    case 'call'
        for j = 1:length(t)
            Sf(j) = S(find(abs(V(:,j)+K-S)< eps_star, 1, 'first'));
        end
end

Contact us at files@mathworks.com