Moving Average Crossover Calculator

Backtest crossovers with fees, sizing, and filters easily. Upload CSV or paste prices in seconds. See signals, returns, and trend strength clearly today here.

Inputs

Configure crossover strategy

Use paste mode for quick testing, or upload a CSV.

Ignore tiny differences between moving averages.
Applied on each entry and exit trade value.
For long/short, size applies per new position.
Formats: date,price or date price. One row per line.
Result will appear above this form after submit.
Example

Sample price series snippet

Date Close Price Short MA (e.g., 5) Long MA (e.g., 10) Typical Signal
2026-01-06 105.00 102.00 101.10 BUY when short crosses above long
2026-01-12 110.00 108.20 106.40 HOLD while short remains above long
2026-01-24 120.00 121.00 121.40 SELL when short crosses below long
Values above are illustrative, not computed from the snippet.
Formula used

Moving averages and crossover signals

Simple Moving Average (SMA)

For window N, the SMA at time t is the mean of the last N prices:

SMA(t) = (P(t) + P(t-1) + ... + P(t-N+1)) / N

Exponential Moving Average (EMA)

The EMA weights recent prices more using α = 2/(N+1):

EMA(t) = α·P(t) + (1-α)·EMA(t-1)

This tool seeds the first EMA value using an SMA of the first window.

Crossover rule

A BUY occurs when the short MA crosses above the long MA. A SELL occurs when it crosses below. Optional filtering ignores small differences below your chosen percentage.

How to use

Step-by-step workflow

  1. Choose SMA or EMA, then set short and long windows.
  2. Select Paste rows or Upload CSV for your price data.
  3. Set capital, fee percent, and optional signal filtering.
  4. Pick long-only or long/short mode, then size positions.
  5. Press Submit to see charts, summary, and tables.

Related Calculators

weighted moving averagesmoothed moving averagecentered moving averageadaptive moving averagevolume moving averagetriangular moving averagetime series averageonline moving averagefast moving averageslow moving average

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.

Moving average crossovers for trend detection

This calculator compares a short window and a long window. It turns price history into signals. It supports SMA and EMA. Both are common in time series work.

Short and long windows shape signal speed

A 10/50 setup reacts faster than 20/100. Faster windows create more trades. They can raise noise. Slower windows reduce churn. They may lag during reversals.

SMA versus EMA changes sensitivity

SMA weights each point equally. EMA weights recent points more. EMA often turns sooner. It can reduce late entries. It can also amplify whipsaws in ranges.

Fees and sizing affect realistic outcomes

Fees apply at each entry and exit. A 0.10% fee compounds. Higher trade counts increase cost drag. Position sizing limits exposure. It also controls equity swings across time.

Risk metrics guide parameter selection

Final equity shows ending value. Net return shows percentage gain. Max drawdown measures peak-to-trough decline. These metrics help compare window pairs. Use the equity curve for visual checks.

Filtering reduces false crossovers in flat markets

The signal filter ignores tiny MA gaps. It uses a percent threshold. This can cut rapid flips. It may miss early moves. Start with 0.25% and test stability across datasets.

FAQs

What data format should I use?

Use one row per date with a price. Accepted formats include YYYY-MM-DD,price and YYYY-MM-DD price. If you upload a CSV, the first two columns are used.

How are BUY and SELL signals created?

BUY occurs when the short moving average crosses above the long one. SELL occurs when it crosses below. The filter can ignore small differences to reduce noisy flips.

What is the difference between long-only and long/short?

Long-only exits to cash on SELL. Long/short reverses the position on SELL. Long/short can gain in downtrends. It can also increase volatility and trading frequency.

Why do I see blank moving average values early?

Moving averages need enough past points. SMA needs the full window length. EMA is seeded after the first window. Early rows show dashes until enough data exists.

How should I choose window lengths?

Pick windows that match your horizon. Shorter windows suit short-term trends. Longer windows suit smoother signals. Compare net return and max drawdown. Avoid overfitting to one period.

Does this replace a full trading backtest?

No. It is a compact crossover study with simple assumptions. It helps explore signals, sizing, and fees. For production use, add slippage, corporate actions, and robust evaluation across regimes.