Professional Documents
Culture Documents
% This part of the code asks for inputs for the initial stock price.
%-------------------------------------------------------------------------
isp_prompt = 'Please input the price of the underlying stock at the start of the
trade: ';
isp = input(isp_prompt);
% This creates the y-axis, $15 above and below the initial stock price.
for ii = 1: 2000
y(ii) = (isp - 15) + ii*(30/2000);
end
%-------------------------------------------------------------------------
if cp == 1
% This asks for the strike price and price per share of the long call contract.
long_strike_prompt = 'Please input the strike price of the LONG call contract:
';
l_strike_price = input(long_strike_prompt);
lc_prompt = 'Please input the cost (per share) of the LONG call: ';
l_cost = input(lc_prompt);
% This asks for the strike price and price per share of the short call
contract.
short_strike_prompt = 'Please input the strike price of the SHORT call
contract: ';
s_strike_price = input(short_strike_prompt);
sc_prompt = 'Please input the cost (per share) of the SHORT call: ';
s_cost = input(sc_prompt);
elseif cp == 2
% This asks for the strike price and price per share of the long put contract.
long_strike_prompt = 'Please input the strike price of the LONG put contract:
';
l_strike_price = input(long_strike_prompt);
lc_prompt = 'Please input the cost (per share) of the LONG put: ';
l_cost = input(lc_prompt);
% This asks for the strike price and price per share of the short put contract.
short_strike_prompt = 'Please input the strike price of the SHORT put contract:
';
s_strike_price = input(short_strike_prompt);
sc_prompt = 'Please input the cost (per share) of the SHORT put: ';
s_cost = input(sc_prompt);
else
wrongcp = '1(calls) or 2(puts) was not entered.';
disp(wrongcp);
end
%-------------------------------------------------------------------------
% Creates Returns
%-------------------------------------------------------------------------
if (cp == 1) && (s_strike_price > l_strike_price)
% Bull Call
tt = 'Bull Call Debit Spread: Returns vs Stock Price';
% This creates the Return values per share at each Stock Price.
% The if loop minimizes the losses of the trade to the initial cost of the
% trade.
for jj = 1:2000
x(jj) = y(jj) - l_strike_price + cost;
if x(jj) < cost
x(jj) = cost;
else x(jj) = x(jj);
end
% The worst case is the difference in the strike prices plus the
% initial net credit.
for jj = 1:2000
x(jj) = s_strike_price - y(jj) + cost;
if x(jj) < s_strike_price - l_strike_price + cost;
x(jj) = s_strike_price - l_strike_price + cost;
else x(jj) = x(jj);
end
% The worst case is the difference in the strike prices plus the
% initial net credit.
for jj = 1:2000
x(jj) = y(jj) - s_strike_price + cost;
if x(jj) < l_strike_price - s_strike_price + cost;
x(jj) = l_strike_price - s_strike_price + cost;
else x(jj) = x(jj);
end
%%%%%%%%%%%%%%%%%%%%%%%%%COVERED CALL%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif trade == 2
tt = 'Covered Call: Stock Price vs. Returns';
ccstrike_prompt = 'Please input the strike price of the covered call: ';
ccstrike = input(ccstrike_prompt);
cccost_prompt = 'Please input the cost of the covered call: ';
cccost = input(cccost_prompt);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%NAKED PUT%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif trade == 3
tt = 'Naked Put: Stock Price vs. Returns';
npstrike_prompt = 'Please input the strike price of the naked put: ';
npstrike = input(npstrike_prompt);
npcost_prompt = 'Please input the cost of the naked put: ';
npcost = input(npcost_prompt);
max_return = npcost;
min = -npstrike + npcost; % Minimum when stock price = 0 + initial credit
for jj = 1:2000
x(jj) = y(jj) - npstrike + npcost;
if x(jj) < min
x(jj) = min;
else x(jj) = x(jj);
end
if x(jj) > max_return
x(jj) = max_return;
else x(jj) = x(jj);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END NAKED PUT%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%COLLAR TRADE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif trade == 4
tt = 'Collar Trade: Stock Price vs. Returns';
ccstrike_prompt = 'Please input the strike price of the covered call: ';
ccstrike = input(ccstrike_prompt);
cccost_prompt = 'Please input the cost of the covered call: ';
cccost = input(cccost_prompt);
lpstrike_prompt = 'Please input the strike price of the long put: ';
lpstrike = input(lpstrike_prompt);
lpcost_prompt = 'Please input the cost of the long put: ';
lpcost = input(lpcost_prompt);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%STRADDLE TRADE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif trade == 6
tt = 'Straddle Trade: Stock Price vs. Returns';
cpstrike_prompt = 'Please input the strike price of the long call and long put: ';
cpstrike = input(cpstrike_prompt);
lccost_prompt = 'Please input the cost of the long call: ';
lccost = input(lccost_prompt);
lpcost_prompt = 'Please input the cost of the long put: ';
lpcost = input(lpcost_prompt);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%STRANGLE TRADE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif trade == 7
tt = 'Strangle Trade: Stock Price vs. Returns';
lcstrike_prompt = 'Please input the strike price of the long call: ';
lcstrike = input(lcstrike_prompt);
lccost_prompt = 'Please input the cost of the long call: ';
lccost = input(lccost_prompt);
lpstrike_prompt = 'Please input the strike price of the long put: ';
lpstrike = input(lpstrike_prompt);
lpcost_prompt = 'Please input the cost of the long put: ';
lpcost = input(lpcost_prompt);
%%%%%%%%%%%%%%%%%%%%%%%STOCK REPAIR/ENHANCEMENT%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif trade == 8
tt = 'Stock Repair/Enhancement: Stock Price vs. Returns';
ccstrike_prompt = 'Please input the strike price of the covered call: ';
ccstrike = input(ccstrike_prompt);
cccost_prompt = 'Please input the cost of the covered call: ';
cccost = input(cccost_prompt);