Mustard Seed Capital Automation (MSCA)
Technical Report: Mathematical Models and Trading Strategies
Document Version: 1.0
Date: March 2026
Classification: Public Technical Documentation
Author: Alexander Fields
Executive Summary
Mustard Seed Capital Automation (MSCA) is a sophisticated automated trading system implementing a buy-and-hold strategy augmented by systematic options income generation. The system leverages the Black-Scholes option pricing model, multi-timeframe stock analysis, and quantitative risk management to execute a disciplined covered call and cash-secured put strategy via the Alpaca Markets API.
This report documents the mathematical foundations, algorithmic decision frameworks, and risk management protocols employed by the system.
Table of Contents
1. System Architecture Overview
1.1 Trading Philosophy
MSCA implements a Buy-and-Hold with Covered Calls (HODL) strategy based on the following principles:
- Long-term stock accumulation in quality equities purchased in 100-share lots
- Income generation through systematic covered call and cash-secured put writing
- Capital preservation via conservative delta thresholds and margin limits
- Capital velocity optimization through early buyback strategies
1.2 Component Architecture
┌─────────────────────────────────────────────────────────────────┐ │ MSCA Trading System │ ├─────────────────────────────────────────────────────────────────┤ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ BlackScholes │ │ StockAnalyzer │ │ Calculations │ │ │ │ Option Pricing │ │ Recovery Score │ │ Tech Indicators│ │ │ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │ │ │ │ │ │ │ └────────────────────┼────────────────────┘ │ │ ▼ │ │ ┌─────────────────────────────────────────────────────────────┐│ │ │ Decider ││ │ │ Trade Decision Engine ││ │ └─────────────────────────────────────────────────────────────┘│ │ │ │ │ ┌────────────────────┼────────────────────┐ │ │ ▼ ▼ ▼ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ PutAnalyzer │ │CashReserveManager│ │ CoveredCallBuyback││ │ │ CSP Selection │ │ Margin Control │ │ Early Buyback ││ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ └─────────────────────────────────────────────────────────────────┘
2. Black-Scholes Option Pricing Model
2.1 Theoretical Foundation
The Black-Scholes model, developed by Fischer Black, Myron Scholes, and Robert Merton (1973), provides the theoretical framework for pricing European-style options. MSCA implements this model for both call and put option pricing.
2.2 Call Option Pricing
The Black-Scholes formula for a European call option:
\[C = S \cdot N(d_1) - K \cdot e^{-rT} \cdot N(d_2)\]
Where:
- \(C\) = Call option price
- \(S\) = Current stock price
- \(K\) = Strike price
- \(r\) = Risk-free interest rate
- \(T\) = Time to expiration (in years)
- \(N(\cdot)\) = Cumulative standard normal distribution function
The intermediate variables are calculated as:
\[d_1 = \frac{\ln(S/K) + (r + \sigma^2/2) \cdot T}{\sigma \sqrt{T}}\]
\[d_2 = d_1 - \sigma \sqrt{T}\]
Where \(\sigma\) = Annualized volatility of the underlying
2.3 Put Option Pricing
The Black-Scholes formula for a European put option:
\[P = K \cdot e^{-rT} \cdot N(-d_2) - S \cdot N(-d_1)\]
This can also be derived from put-call parity:
\[P = C - S + K \cdot e^{-rT}\]
2.4 Implementation Details
The system handles edge cases:
| Condition | Handling |
|---|---|
| \(T \leq 0\) (expired) | Returns intrinsic value: \(\max(S-K, 0)\) for calls |
| \(\sigma \leq 0\) | Clamps to minimum: \(\sigma_{min} = 10^{-5}\) |
| Extreme \(d\) values | Clamps \(d\) to range \([-10, 10]\) to prevent numerical overflow |
2.5 Greeks Calculation: Delta
Delta measures the rate of change of option price with respect to the underlying price.
Call Delta:
\[\Delta_{call} = N(d_1)\]
Range: \([0, 1]\) - Approaches 1 for deep ITM, 0 for deep OTM
Put Delta:
\[\Delta_{put} = N(d_1) - 1\]
Range: \([-1, 0]\) - Approaches -1 for deep ITM, 0 for deep OTM
2.6 Implied Volatility Calculation
MSCA calculates implied volatility using a binary search algorithm:
Algorithm: Implied Volatility via Bisection
Input: Market price P_market, S, K, T, r, option type
Output: Implied volatility σ
1. Set bounds: σ_low = 0.001, σ_high = 5.0
2. Set initial guess: σ = 0.30
3. For i = 1 to max_iterations:
a. Calculate P_model = BS_Price(S, K, T, σ, r)
b. If |P_model - P_market| < precision:
return σ
c. If P_model > P_market:
σ_high = σ
d. Else:
σ_low = σ
e. σ = (σ_low + σ_high) / 2
4. Return σConvergence parameters:
- Precision: \(10^{-4}\)
- Maximum iterations: 100
3. Statistical Volatility Analysis
3.1 Historical Volatility Calculation
MSCA calculates annualized volatility using logarithmic returns:
\[\sigma = \sqrt{A} \cdot \sqrt{\frac{1}{n-1} \sum_{i=1}^{n} (r_i - \bar{r})^2}\]
Where:
- \(r_i = \ln(P_i / P_{i-1})\) = Log return
- \(\bar{r}\) = Mean log return
- \(A\) = Annualization factor
Annualization Factors:
| Data Frequency | Factor \(A\) |
|---|---|
| Daily bars | \(\sqrt{252}\) |
| Hourly bars | \(\sqrt{252 \times 6.5} = \sqrt{1638}\) |
3.2 84th Percentile Maximum Move Analysis
For strike selection, MSCA uses empirical percentile analysis rather than theoretical distributions. This approach calculates the 84th percentile of historical maximum price movements within a given DTE window.
Algorithm: Percentile Max-High Calculation
For each starting bar i in historical data: 1. Define window: bars[i] to bars[i + DTE] 2. Find max_high = max(High[j]) for j in window 3. Calculate move: max_move[i] = (max_high - Close[i]) / Close[i] Sort all max_moves ascending Return max_moves[84th percentile index]
Data Requirements:
- Minimum 3,000 hourly bars (~2 years of trading data)
- Minimum 500 rolling windows for statistical significance
- Returns -1 (invalid) if insufficient data
Application:
- Covered Calls: 84th percentile max-high determines minimum strike buffer
- Cash-Secured Puts: 84th percentile max-low determines strike distance below current price
4. Stock Selection and Recovery Scoring
4.1 Multi-Timeframe Analysis Framework
MSCA employs a 100-point scoring system to evaluate stocks for buy-and-hold suitability:
| Category | Points | Description |
|---|---|---|
| Long-Term Fundamentals | 60 | Uses ALL available historical data |
| Entry Timing | 40 | Uses recent 2 years only |
| Total | 100 | Score ≥ 60 = Buy candidate |
4.2 Long-Term Growth Score (25 points)
Calculates Compound Annual Growth Rate (CAGR) over full historical period:
\[\text{CAGR} = \left(\frac{P_{end}}{P_{start}}\right)^{1/n} - 1\]
4.3 Crash Resilience Score (20 points)
Analyzes recovery patterns from major drawdowns (>20% decline):
\[\text{Recovery Rate} = \frac{\text{Number of Recoveries}}{\text{Number of Major Drawdowns}}\]
Recovery Definition: Price returns to 95% of pre-drawdown peak
4.4 Position Averaging Evaluation
For existing positions, MSCA evaluates averaging down opportunities using a 10-factor scoring system.
Eligibility Criteria:
- Position is underwater (current price < cost basis)
- Loss percentage: 5% ≤ loss ≤ 30%
- Minimum 1,300 hourly bars available
Decision Rule: Score ≥ 0.5 (5/10 factors positive) → Recommend averaging down
5. Technical Indicators
5.1 Exponential Moving Average (EMA)
\[\text{EMA}_t = P_t \cdot k + \text{EMA}_{t-1} \cdot (1-k)\]
Where \(k = \frac{2}{n + 1}\) (smoothing factor), \(n\) = period length
5.2 Moving Average Convergence Divergence (MACD)
\[\text{MACD} = \text{EMA}_{12} - \text{EMA}_{26}\]
\[\text{Signal} = \text{EMA}_9(\text{MACD})\]
5.3 Relative Strength Index (RSI)
\[\text{RSI} = 100 - \frac{100}{1 + RS}\]
Where \(RS = \frac{\text{Average Gain}}{\text{Average Loss}}\)
- RSI > 70: Overbought
- RSI < 30: Oversold
5.4 Simple Moving Average (SMA)
\[\text{SMA}_n = \frac{1}{n} \sum_{i=0}^{n-1} P_{t-i}\]
6. Options Strategy Implementation
6.1 Covered Call Strategy
Objective: Generate premium income while holding long stock positions.
Strike Selection Algorithm:
- Calculate 84th percentile max-high for target DTE
- Apply DTE-based buffer multiplier
| DTE Range | Base Buffer |
|---|---|
| 1-7 days | 3% |
| 8-14 days | 5% |
| 15-21 days | 6% |
| 22-30 days | 8% |
6.2 Cash-Secured Put Strategy
Objective: Generate premium income while accumulating quality stocks at discount.
Candidate Selection (PutAnalyzer) - 0-100 Score:
| Factor | Points | Criteria |
|---|---|---|
| Historical Recovery | 30 | Past bounce patterns |
| Above 200-day MA | 20 | Bullish long-term trend |
| High Volume (>500K) | 15 | Liquidity |
| Moderate Volatility (20-50%) | 15 | Premium opportunity |
| Higher Lows Pattern | 20 | Upward trend |
6.3 SPY "Golden Child" Treatment
SPY (S&P 500 ETF) and IWM receive special handling as index ETFs:
| Parameter | Index ETFs (SPY/IWM) | Standard Stocks |
|---|---|---|
| Covered Call Delta | ≤ 0.10 | No limit (buffer-based) |
| 0DTE Support | Yes | No |
6.4 Early Buyback Strategy
Philosophy: Capital velocity > maximum profit extraction
\[\text{Threshold} = T_{min} - \left(\frac{\text{DTE} - 1}{\text{DTE}_{max} - 1}\right) \times (T_{min} - T_{max})\]
Where \(T_{min} = 0.40\) (40% at 1 DTE), \(T_{max} = 0.15\) (15% at 30 DTE)
7. Risk Management Framework
7.1 Option Safety Assessment
Call Option Safety Check:
\[\text{Safe} = (\Delta_{call} < \text{SafetyFactor})\]
Default safety factor: 0.30
7.2 Volatility Threshold
Stocks with excessive volatility are excluded from covered call writing:
\[\text{Skip if: } \sigma_{annual} > 90\%\]
7.3 Data Freshness Check
Trades require recent price data:
\[\text{Max Age} = 60 \text{ minutes}\]
8. Capital Allocation Model
8.1 Margin Limit Enforcement
Standard Stocks:
\[\text{Max Margin} = \text{Account Value} \times 20\%\]
Premium ETFs (SPY, QQQ, IWM, DIA, VOO, VTI):
- No margin limit
- Uses all available buying power
8.2 Collateral Calculation
For cash-secured puts:
\[\text{Collateral} = \text{Strike Price} \times \text{Contracts} \times 100\]
8.3 Position Sizing
Each new stock position limited to:
\[\text{Max Position} = \frac{\text{Buying Power}}{3}\]
Appendix: Formula Reference
A.1 Black-Scholes Formulas
| Formula | Expression |
|---|---|
| \(d_1\) | \(\frac{\ln(S/K) + (r + \sigma^2/2)T}{\sigma\sqrt{T}}\) |
| \(d_2\) | \(d_1 - \sigma\sqrt{T}\) |
| Call Price | \(S \cdot N(d_1) - Ke^{-rT} \cdot N(d_2)\) |
| Put Price | \(Ke^{-rT} \cdot N(-d_2) - S \cdot N(-d_1)\) |
| Call Delta | \(N(d_1)\) |
| Put Delta | \(N(d_1) - 1\) |
A.2 System Constants
| Constant | Value | Location |
|---|---|---|
| MAX_MARGIN_PERCENT | 20% | CashReserveManager |
| COMMODITY_MAX_PERCENT | 15% | CashReserveManager |
| THRESHOLD_AT_MIN_DTE | 40% | CoveredCallBuyback |
| THRESHOLD_AT_MAX_DTE | 15% | CoveredCallBuyback |
| MIN_REQUIRED_BARS | 3,000 | StockAnalyzer |
| RECOVERY_SCORE_THRESHOLD | 60 | StockAnalyzer |
"If you have faith as small as a mustard seed... nothing will be impossible for you." - Matthew 17:20