130 likes | 201 Views
Engineering 25. Prob 7.18 Solution Stock Market Simulation: Buy? Sell? Hold?. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. Scenario. Behavior of Certain Stock Price, P, is randomly set by NORMAL distribution µ = $100 σ = $5
E N D
Engineering 25 Prob 7.18SolutionStock Market Simulation: Buy? Sell? Hold? Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu
Scenario • Behavior of Certain Stock • Price, P, is randomly set by NORMAL distribution • µ = $100 • σ = $5 • Simulate Stock behavior over 250 days (1 trading year) • Trading Algorithm • If P<100, → BUY 50 Shares • If P>105 → SELL ALL shares • If 100< P < 105 → HOLD • Add to Profit the Value of Stock HELD at END of Year
Key to Problem • The Critical Issue required to get close to the BOOK answer is to realize: • That at YEAR’S END we must Assess the Value of Any Shares NOT SOLD • We will Very Likely (84.13% chance) have shares “Left Over” if P250 < $105 • Add the Held-Over Value to the previous selling profit
Method-1 Results (1-Run) =Stock purchase Profit summary = SellDays = 38 BuyDays= 133 HoldDays= 79 NoSharesLeftInPortfolio= 50 YearEndPrice= 98.9097 YearEndValue= 4.9455e+003 DailyProfit= 6.4715e+004 TotalProfit= 6.9660e+004
Method-2 Results mean_yearly_profit= 6.5054e+004 min_yearly_profit= 4.9024e+004 max_yearly_profit= 9.0948e+004 std_profit= 5.7442e+003 MEAN_YrEnd_Price= 99.8867 AVG_YrEnd_Shares= 154.4088 MIN_YrEnd_Shares= 0 MAX_YrEnd_Shares= 1250
Method-1: 499 Runs = Stock purchase Profit summary = MAXProfit= 8.5555e+004 MINProfit= 4.6147e+004 AvgProfit = 6.4593e+004 StdPprofit= 5.7947e+003 AvgEndShares= 168.0361