Simple Moving Average Calculator (SMA)
The simple moving average (SMA) is the arithmetic mean of the most recent N values — the foundational smoother for technical analysis, demand forecasting, KPI dashboards and any time-series work. Paste a list of numbers (space-, comma- or newline-separated), pick the window length N, and the tool returns the full SMA series, the latest SMA point, plus the trailing-window min, max and standard deviation for context.
Paste a valid number series and an N ≥ 1.
Latest SMA
—
—
Window min
—
Window max
—
Window σ
—
Full SMA series
Formula
SMA_t(N) = (x_{t−N+1} + x_{t−N+2} + … + x_t) ⁄ N Incremental update: SMA_t = SMA_{t−1} + (x_t − x_{t−N}) ⁄ N
- · References: Murphy, "Technical Analysis of the Financial Markets" (1999), ch. 9; NIST/SEMATECH e-Handbook §6.4.1, "Moving Average".
- · Common windows: 20-day (4 weeks), 50-day (10 weeks) and 200-day (40 weeks) for equity charting. Crossovers between a fast/short SMA and a slow/long SMA form the "golden cross" (short crosses above long → bullish) and "death cross" (short crosses below long → bearish).
- · The first N − 1 positions have no SMA value (the window isn't full yet); the tool starts emitting numbers from index N. A 100-point series with N = 20 yields 81 SMA points.
- · SMA is an equally-weighted mean — every observation in the window carries weight 1 ⁄ N, so it reacts slowly to recent data. To upweight the latest points use the exponential moving average (EMA) or a weighted moving average (WMA).
- · Incremental update SMA_t = SMA_{t−1} + (x_t − x_{t−N}) ⁄ N runs in O(1) per step — this is the rolling-sum strategy the tool uses, so 10,000-point series still update instantly.
- · Limitation: SMA is a lagging indicator — trend reversals show up about N/2 periods late. Sharp moves (price breakouts, demand shocks) are dampened. Combine with RSI, MACD or Bollinger Bands for confirmation rather than reading SMA alone.
Frequently asked
SMA, EMA or WMA — which one should I use?
All three solve the same problem (smoothing noise) but weight the latest data differently. (1) SMA: equal weights, easiest to explain, but reacts slowly and has the "drop-off effect" — the value jumps when the oldest point leaves the window. Best for long-horizon trends, monthly reporting and KPI dashboards. (2) EMA (exponential): weights newest data most heavily (α = 2 ⁄ (N+1)), no drop-off, responds fastest; default in TradingView, MetaTrader and TA-Lib. Preferred for short-term trading and turning-point detection. (3) WMA (linearly weighted): in between, weight of the i-th point = i ⁄ (1+2+…+N); rarely used today because EMA is simpler and almost as fast-reacting. Rule of thumb: 200-day SMA for long-term equity trends, 12/26-day EMA for MACD-style signals, SMA again for executive dashboards.
Why does back-testing a "golden cross" SMA strategy often fail to make money?
Two reasons. First, SMA is a lagging indicator: a golden cross typically prints 5–15 trading days after the actual bottom, so a chunk of the rally is missed; death crosses likewise mark a late exit. Second, the market regime matters: 1980–2000 was a long secular bull and the 50/200 cross strategy did beat buy-and-hold on average; post-2000 (especially the 2008–2020 central-bank era) was choppy, generating many whipsaw signals and eating the edge with commissions. Brock, Lakonishok & LeBaron (1992) found significant excess returns from SMA rules in the Dow pre-1980, but Sullivan, Timmermann & White (1999) showed the effect largely disappears once you correct for data snooping. Practical fixes: (1) always run out-of-sample tests; (2) add an ATR-based stop; (3) only trade in strong trends (ADX > 25); (4) beware of curve-fitting the window lengths. SMA isn't broken — using it in isolation, ignoring transaction cost and ignoring regime is.
I have 10 data points; N=5 and N=10 give very different results. Which window should I use?
Window length is a smoothness-vs-responsiveness trade-off — large N smooths better but reacts slowly; small N is responsive but keeps the noise. Practical picks: (1) match the natural cycle: daily data → 5 (week), 20 (month), 60 (quarter); monthly sales → 3 (quarter), 12 (year). (2) Signal-to-noise: SMA reduces the per-point standard deviation by √N. Pick the smallest N for which σ ⁄ √N is acceptable — N ≥ 9 already cuts noise to one third. (3) Cross-validation: hold out a validation set, sweep N = 2…20 and pick the N with the lowest MSE on the validation set. (4) Business semantics: "last 5 months" is easier to explain to stakeholders than "last 17 months". With only 10 points, N = 3–5 is the sane range — N = 10 reduces to a single point and is no longer a moving average.
Related tools
Mortgage Monthly Payment Calculator
Enter property price, down payment, term and rate — get monthly payment, total interest and total payable.
Hong Kong Stamp Duty Calculator
Compute Ad Valorem Stamp Duty (AVD) on residential property at the latest rates.
Hong Kong Salaries Tax Calculator
Estimate Hong Kong salaries tax using both the progressive bands and the 15% / 16% two-tier standard rate (Year of Assessment 2024/25).
Hong Kong MPF Contribution Calculator
Hong Kong MPF contributions for employees, employers and self-employed persons using the statutory 5% rate with the $7,100 minimum and $30,000 maximum relevant income thresholds.
Compound Interest Calculator
Project the future value of a principal plus regular monthly or yearly contributions at a given annual rate, with total interest earned.
CAGR (Compound Annual Growth Rate) Calculator
Compute the compound annual growth rate from a start value, end value and number of years — useful for comparing long-term growth.
ROI (Return on Investment) Calculator
Compute total profit, ROI % and annualised return from initial cost, final value and holding period — useful for comparing investments.
Inflation / Purchasing Power Calculator
Project the future purchasing power of an amount given an annual inflation rate and time horizon — and the nominal amount needed to keep up.
Markup & Margin Calculator
Convert between cost, selling price, markup % and gross margin % — handy for retail pricing and SMB profit analysis.
Break-Even Point Calculator
From fixed costs, variable cost per unit and selling price, find the units needed to cover all costs — plus break-even revenue, contribution margin, target-profit volume and margin of safety.
APR ↔ APY Calculator (Nominal vs Effective Annual Rate)
Convert a nominal annual rate (APR) at any compounding frequency to the effective annual yield (APY), or solve the inverse — essential for comparing credit-card, savings-account and mortgage rates.
Rule of 72 Calculator (Doubling Time)
Quickly estimate how many years to double your money at a given compound rate, or what rate is needed to double in a target period — with the exact logarithmic answer alongside.
Loan Payoff Time Calculator
From balance, monthly payment and APR, compute how many months until the loan is paid off, the total interest paid, and the minimum payment that just covers interest.
Savings Goal Calculator
Given goal amount, current savings, monthly deposit and APR, see how many months it takes to hit the target.
Annuity Payment Calculator
Enter principal, annual rate and number of periods to compute the fixed annuity payment (PMT formula) — essential for retirement-income planning.
Net-to-Gross Salary Calculator (Hong Kong)
Enter the after-tax salary you want to take home and the calculator works back to the gross figure you need to offer (HK MPF and salaries-tax aware).
Rental Yield Calculator
Enter property price, monthly rent and yearly expenses (rates, management, insurance, vacancy) to see both gross and net rental yield (%).
Dividend Yield Calculator
Enter annual dividend per share, share price, EPS and amount invested to compute dividend yield (%), payout ratio (%) and projected yearly income.
Sales Tax / VAT Calculator
Enter a price and a tax rate to compute the gross total and tax amount, or work backwards from a tax-inclusive price to the net amount.
Hong Kong Loan-to-Value (LTV) Ratio Calculator
Enter property value and loan amount to get the LTV ratio, the required down-payment, and a live check against HKMA caps and the HKMC mortgage insurance ceilings.
Present Value (PV) Calculator
Discount a future amount back to today using an annual rate, horizon and compounding frequency — get the present value, discount factor and effective annual rate.
Real Interest Rate (Fisher Equation) Calculator
Use the Fisher equation to strip inflation from a nominal rate and find the real return, with the common r ≈ i − π approximation alongside.
Safe Withdrawal Rate (4% Rule) Calculator
Apply the Trinity Study 4% rule: enter your retirement nest egg and a withdrawal rate to see the annual and monthly income it can support.
Debt-to-Income (DTI) Ratio Calculator
Enter monthly debt payments and gross monthly income to compute your DTI ratio against the standard lender bands (36% / 43% / 50%).
Simple Interest Calculator
Enter principal, annual rate and term and apply I = P × r × t to find the interest earned or owed under simple-interest accrual (no compounding).
Net Present Value (NPV) Calculator
Enter the initial outlay, future cash flows and a discount rate to compute the project Net Present Value (NPV) — positive NPV means the project beats your required return.
Internal Rate of Return (IRR) Calculator
Enter the upfront investment, projected yearly cash flows and a hurdle rate to solve for the discount rate that makes NPV = 0 — and see at a glance whether the project beats your required return.
Sharpe Ratio Calculator
Enter your portfolio annual return, the risk-free rate and the annualised standard deviation to compute the Sharpe ratio — excess return earned per unit of risk taken.
Mortgage Refinance Break-Even Calculator
Compare your current mortgage against a new rate, net of refinance closing costs and penalties, to find how many months to break even and whether the whole loan saves or costs more over its lifetime.
Bond Price Calculator
From face value, coupon rate, yield-to-maturity, years to maturity and coupon frequency, compute a fixed-coupon bond's present price, premium/discount and current yield.
Future Value of Annuity Calculator
Compute the future value of a stream of equal payments (e.g. monthly savings or pension contributions) with end- or beginning-of-period timing.
WACC (Weighted Average Cost of Capital) Calculator
Enter the market values of equity and debt, the cost of equity, the cost of debt and the corporate tax rate to compute the weighted-average cost of capital (WACC), capital-structure weights and after-tax cost of debt.
Earnings Per Share (EPS) Calculator
Enter a company's net income, preferred dividends and weighted-average common shares outstanding to compute basic EPS, with an optional dilutive-securities input for diluted EPS.
Dollar-Cost Averaging (DCA) Calculator
Enter a fixed amount per period and the buy price for each period to see total invested, total shares, average cost and current value — with a side-by-side comparison against putting the same money in as a lump sum at the first price.
Position Size Calculator (Stock / Forex Risk)
Enter account size, per-trade risk percent and stop-loss distance to compute the share/lot quantity that caps your loss at the chosen risk.
Debt Snowball Payoff Plan Calculator
Enter several debts (balance, APR, minimum payment) and your monthly extra budget; the tool runs the classic "smallest balance first" snowball method, estimating each debt's payoff month, total interest paid and total months to debt-free.
Payback Period Calculator (Simple & Discounted)
Enter an initial investment, level annual cash inflow, discount rate and horizon to instantly see the simple payback period, the discounted payback period and the terminal Net Present Value (NPV), plus a year-by-year cumulative cash-flow table — built for capital-budgeting, small-business investments, solar installs and equipment purchase decisions.
Pay Raise Calculator (Percentage, Amount, New Salary)
Enter your current salary, raise percentage or dollar amount and instantly see your new salary plus annual, monthly, weekly and hourly differences — handy for comparing offers, negotiating reviews and gauging inflation-adjusted raises.
Sinking Fund Payment Calculator (Save-to-Target)
Enter a target amount (FV), expected annual return and term — the tool back-solves the periodic payment you need to reach that target, the classic "how much to save monthly to hit $X by year Y" question.
Perpetuity Present Value Calculator
Enter the level periodic cash flow C and the discount rate r — the tool returns the perpetuity present value PV = C / r and, optionally, the growing-perpetuity Gordon value PV = C / (r − g) used for consols, preferred shares and dividend-discount models.
Mortgage Discount Points Break-Even Calculator
Enter the loan amount, the number of discount points bought and the rate reduction per point — the tool returns the upfront cost, the monthly payment saving and the break-even month so you can decide whether paying points is worth it.
Debt Service Coverage Ratio (DSCR) Calculator
Enter net operating income (NOI) and total annual debt service (principal + interest); the tool reports the debt service coverage ratio DSCR = NOI / debt service — the headline risk metric banks use when underwriting commercial property loans, business loans and investment-property mortgages.
Price-to-Earnings (P/E) Ratio Calculator
Enter a share price and EPS — the tool returns the price-to-earnings ratio P/E, the earnings yield (EPS ÷ price), and the PEG ratio (if a growth rate is supplied), then puts the result in context with typical industry bands.
Debt-to-Equity (D/E) Ratio Calculator
Enter total liabilities and shareholders' equity to get the D/E ratio, equity multiplier and debt-to-assets ratio, with industry context (utilities, tech, banking) to flag whether the firm's capital structure is conservative or aggressive.
Gordon Growth Model Calculator (DDM)
Enter next year's dividend D₁, the required return r and the perpetual growth rate g; the Gordon dividend-discount model returns the intrinsic price P = D₁ / (r − g) and the growth rate implied by today's market price.
DuPont Analysis Calculator (3-Factor ROE)
Enter net income, revenue, assets and equity; the tool applies the 3-factor DuPont identity to decompose ROE = Net Margin × Asset Turnover × Equity Multiplier, so you can see whether high returns come from profitability, efficiency or leverage.
Current Ratio Calculator
Enter current assets (cash, receivables, inventory) and current liabilities (short-term debt, payables) to get the current ratio = CA ÷ CL, with industry-standard thresholds (< 1 warning, 1–2 healthy, > 3 idle cash) to flag short-term solvency at a glance.
Quick Ratio Calculator (Acid-Test Ratio)
Enter cash, marketable securities, receivables and current liabilities; the tool returns the quick ratio = (CA − inventory − prepaid expenses) ÷ CL, a stricter view of liquidity than the current ratio because it excludes inventory and prepayments that may not convert to cash quickly.
Return on Equity (ROE) Calculator
Enter net income and shareholders' equity (beginning / ending / average); the tool returns ROE = net income ÷ equity with the conventional bands (< 5% weak, 10–15% healthy, > 20% excellent), so you can read management's efficiency at deploying equity capital at a glance.
Price-to-Book (P/B) Ratio Calculator
Enter share price and book value per share (or total equity + shares outstanding); the tool returns P/B = price ÷ book value and benchmarks it against typical banks, insurers, real estate and SaaS bands — a core value-investing screen used since Benjamin Graham.
Economic Order Quantity (EOQ) Calculator
Enter annual demand D, ordering cost per order S and holding cost per unit per year H; the tool applies the Wilson formula Q* = √(2DS / H) to return the optimal order quantity, order frequency and total inventory cost — the classic recipe for stock-keeping and supply-chain planning.
Operating Margin Calculator
Enter operating income (EBIT) and total revenue; the tool returns the operating margin = EBIT ÷ revenue, then benchmarks the result against software, branded consumer, manufacturing, retail and airline norms — the cleanest single read on core operating efficiency.
CAPM Calculator (Capital Asset Pricing Model)
Enter the risk-free rate Rf, expected market return Rm and the stock's beta β; the CAPM formula r = Rf + β·(Rm − Rf) returns the required rate of return (cost of equity) and breaks out the equity risk premium component (ERP × β).
Inventory Turnover Ratio Calculator
Enter annual cost of goods sold (COGS) and average inventory; the tool returns the inventory turnover ratio (Turnover = COGS ÷ Avg Inventory) and days inventory outstanding (DIO = 365 ÷ Turnover) — the standard lens for retail, manufacturing and e-commerce to gauge stocking efficiency and working-capital tie-up.
Sortino Ratio Calculator
Enter a series of periodic returns and a target return (often 0 or the risk-free rate); the tool returns the Sortino ratio = (R̄ − T) ÷ DD, where DD is downside deviation — a risk-adjusted return measure that captures only "bad" volatility (often preferred over the Sharpe ratio) — and annualises it based on the chosen frequency.
Treynor Ratio Calculator
Enter portfolio return, risk-free rate and beta; the tool returns the Treynor ratio = (Rp − Rf) / β — excess return per unit of market (systematic) risk. It is the β-based analogue of the Sharpe ratio and is favoured for evaluating diversified portfolios and fund managers.
Cash Conversion Cycle Calculator (CCC = DIO + DSO − DPO)
Enter days inventory outstanding (DIO), days sales outstanding (DSO) and days payable outstanding (DPO); the tool returns the cash conversion cycle — the number of days between paying suppliers and collecting from customers, a key measure of working-capital efficiency.
PEG Ratio Calculator (P/E to Earnings Growth)
Enter the P/E ratio and the expected annual EPS growth rate (%); the tool returns the PEG ratio = P/E ÷ growth, popularised by Peter Lynch — a more honest valuation read for growth stocks than the P/E alone.
Interest Coverage Ratio Calculator (ICR = EBIT ÷ Interest)
Enter EBIT and interest expense; the tool returns the interest-coverage ratio (also called Times Interest Earned) — a core credit metric used by rating agencies and lenders to judge a firm's ability to service its debt.
Risk/Reward Ratio Calculator
Enter your entry price, target and stop-loss; the tool returns the reward-to-risk ratio and the minimum win-rate required to break even — the headline check every trader runs before sizing a position.
Maximum Drawdown Calculator
Paste a price or NAV series and the tool returns the maximum drawdown (MDD), peak, trough, drawdown duration and recovery time — the benchmark downside-risk metric for any strategy.
PERT 3-point Estimate Calculator
Enter the optimistic (O), most-likely (M) and pessimistic (P) estimates; the tool applies the PERT beta-distribution formulas E = (O + 4M + P)/6 and σ = (P − O)/6, and reports the 1σ / 2σ / 3σ confidence ranges for project duration or cost.
Bond Yield to Maturity (YTM) Calculator
Enter face value, coupon rate, years to maturity and current market price; the tool bisects for the bond's yield to maturity (YTM), current yield and total coupon cash flows — the discount-rate benchmark used in bond pricing, credit-spread analysis and retirement-portfolio planning.
Capitalization Rate (Cap Rate) Calculator
Enter net operating income (NOI) and property value to get the capitalization rate (NOI ÷ value). The tool also solves in reverse — give it any two of {cap rate, NOI, value} and it derives the third — the standard yardstick real-estate investors use to compare property yields.
Bond Duration Calculator (Macaulay & Modified Duration)
Enter face value, coupon rate, term, payment frequency and yield-to-maturity; the tool returns the Macaulay duration (the cash-flow-weighted average years to maturity) and modified duration (the % price drop for a 1 % rise in yield) — the standard measures of a bond's interest-rate risk.
Home Affordability Calculator (28 / 36 Rule)
Enter gross monthly income, existing monthly debt, mortgage rate and term; the tool applies the lending-industry 28 / 36 rule to estimate the maximum PITI you can afford and the corresponding home price — a universal pre-shopping affordability screen.
Cost of Living Adjustment (COLA) Calculator
Enter current salary or pension, the year-over-year change in CPI and the COLA formula to apply; the tool returns the inflation-adjusted new amount and real purchasing power — used for contract renewals, pension uplifts and year-on-year comparisons.
Annualized Volatility Calculator (σ × √N)
Enter the standard deviation of daily, weekly or monthly returns; the tool applies the √N rule σ_annual = σ_period × √N to give the annualised volatility — the standard preprocessing step for Sharpe ratio, option pricing and risk reports.
Price Elasticity of Demand Calculator (Ed)
Enter two price–quantity pairs; the tool applies the midpoint (arc) formula Ed = (ΔQ ⁄ Q̄) ⁄ (ΔP ⁄ P̄) and classifies demand as elastic, unit-elastic or inelastic — a staple of microeconomics, pricing decisions and tax-incidence analysis.
Tax-Equivalent Yield Calculator (TEY)
Enter a tax-exempt bond yield (e.g. US municipal bonds) and your marginal tax rate; the tool applies TEY = tax-free yield ⁄ (1 − tax rate) to give the equivalent pre-tax yield a taxable bond must offer to match it — the standard yardstick for comparing investments with different tax treatments.
Gini Coefficient Calculator
Paste a list of incomes / wealth / sales values; the tool computes the Gini coefficient via G = Σ|xᵢ − xⱼ| / (2 n² · mean) (0 = perfect equality, 1 = total inequality) and reports the Lorenz curve and cumulative distribution — used in economics, sociology and sales-concentration analysis.