function plotlimit(H,L,O,C,price,days) % suppose we place a limit order to sell at limit prices % vol is the annual volatility of the stock and price is the current price. % vol is output from estvol % assumes we input Open, Close, High, Low, daily prices and the price %limit order is good for ____ days. vol=estvol(H,L,O,C,1/252) r=.05 ;% annual interest rate x=price+[0:.5:5]; mu=(r-vol^2/2)*days/252; sig=sqrt(days*vol^2/252); p=min(1,2*normcdf(-log(x./price),mu,sig)); %x are the limit points and p are the corersponding probability of order filled. % plots the values of x versus p or the value of the probability of the order being filled for % each limit price bar3(x,p) axis([0 .5 min(x)-1 max(x)+1 0 1]) colormap([0 .9 0]) ylabel('LIMIT POINTS FOR SELL ORDER') zlabel('PROBABILITY ORDER FILLED')