Supervised Project · SCE · Computer Science · Beer Sheva

TradeMind

An interpretable algorithmic-trading research platform that models market states probabilistically and converts those forecasts into risk-aware analysis and portfolio-allocation recommendations.

2025–2026Jlaa Amara · Abdallah IsmailVariable-order Markov chainsMonte CarloFastAPI + React
10return states
5,000Monte Carlo paths per forecast
1–60day forecast horizon
Livedeployed web application
Research question

What is the distribution of tomorrow’s return, given the recent market state sequence?

Rather than producing a single deterministic “up/down” call, TradeMind discretizes daily returns into a ten-state space and estimates conditional transition probabilities from recent state histories. A variable-order mechanism backs off to shorter contexts when a longer history has never been observed.

The broader engineering question is how to combine those probabilistic forecasts with conventional indicators in a system that remains transparent enough for a user to inspect why a recommendation was produced.

Primary objectives

  • Probabilistic next-state forecasting
  • Technical-indicator integration
  • Risk classification
  • Interpretable scoring
  • Portfolio allocation
  • Interactive visualization
Pipeline

From OHLCV data to state-conditional decisions

TradeMind pipeline from market data through state discretization, Markov forecasting, Monte Carlo simulation and technical indicators to recommendations and portfolio allocation.
The platform combines probabilistic state forecasting with technical and risk signals rather than relying on a single indicator.
Working application

The deployed interface exposes the model, not only a recommendation.

Screens from the final report: the ranked watchlist with risk labels, indicators and a suggested allocation, and the empirical state-transition graph behind the forecasts.

TradeMind dashboard listing four tickers with recommendation, risk level, score and technical indicators, above an investment-amount selector.
The dashboard ranks a watchlist by profit score and shows each ticker’s risk class and indicators, here with a 2-year history window. Select the image to open it full size.
TradeMind transition graph of ten return-bucket states for SPY, with edges labelled by transition probability.
The empirical Markov chain for SPY over two years: nodes are return buckets and edges are transition probabilities of at least 0.05. Select the image to open it full size.
Methods

An interpretable quantitative stack

Variable-order Markov model

Transition probabilities are estimated from historical state sequences with Laplace smoothing (a small pseudo-count that keeps every transition from having zero probability). The model uses the longest observed context available and backs off when needed.

Monte Carlo horizon forecast

Thousands of simulated state paths propagate the one-step transition model across configurable horizons, producing a distribution rather than one point estimate.

Technical & risk layer

RSI, moving averages, momentum and volatility are combined with the probabilistic forecast in a transparent multi-component scoring and risk-classification layer.

Reading a forecast

From recent history to a probability distribution.

The model describes each day by one of ten return ranges, for example “0.5% to 1%” or “below −3%”. These are its states, and the forecast is a probability for each of them.

Backoff, with an example

Suppose the last three states were (flat, small gain, large loss). If that exact sequence never occurred in the history, the model tries the last two states, then the last one, and if even that fails it uses the overall frequency of each state. The reason is sparsity: with ten states there are 10k possible histories of length k, about 100,000 for five days, and a two-year window holds only around 500 trading days, so long histories are rarely seen.

Monte Carlo over several days

For a multi-day horizon the model simulates 5,000 possible paths. At each step it draws the next state from the probabilities for the current history. The share of paths that end in each state is the horizon distribution, and the share ending in a positive-return state is the horizon positive probability. This shows the uncertainty around the forecast; it does not make the forecast more accurate than the model's probabilities.

Two bar charts of forecast probabilities for SPY over ten return ranges: the next-day distribution, nearly flat with one taller bar, and the 5-day Monte Carlo horizon distribution, more spread out.
Next-day and 5-day forecast distributions for SPY from the final report (two-year window). In the next-day panel nine states are at 9.1% and one at 18.2%, which is what add-one smoothing gives for a history seen only once, a reminder of how little evidence a long context can carry. The 5-day panel comes from 5,000 simulated paths. Select the image to open it full size.
Validation

The forecast is evaluated as a probability distribution.

The final system compares predicted next-state probabilities against the realized state using the Brier score: the average squared difference between the predicted probabilities and what happened (1 for the state that occurred, 0 for the others). Lower is better, and it rewards well-calibrated probabilities, not only a correct most-likely state.

Brier = (1/N) Σi Σj (pij − yij)²

The report says the probabilities were better than a naive uniform guess but does not publish a numeric Brier score, so none is quoted here. A forecast that spreads probability evenly over ten states would score 0.9 per prediction.

The application also exposes transition matrices, state distributions and the components of its recommendation score, keeping the modeling process inspectable.

Delivered system

  • Automated yfinance data ingestion
  • Python / FastAPI backend
  • React dashboard
  • Directed state-transition visualization
  • Multi-asset analysis
  • Live deployment
Challenges & limitations

The difficult parts are exactly where quantitative systems usually break.

Non-stationarity

Transition behavior changes across regimes, so probabilities learned from one market environment can become stale.

State-space explosion

Longer context histories can become too sparse. Variable-order backoff is a direct response to this problem.

Trading frictions

The current system does not fully model slippage, transaction costs and short-borrow constraints, all of which matter for real deployment.

Forecast quality is not profitability

Well-calibrated probabilities describe how likely each outcome was; they say nothing by themselves about whether trading on them would be profitable after costs. The page reports model output and its validation, not trading performance.

Backtesting depth

The report identifies a comprehensive multi-cycle backtest against static benchmarks as an important next step before making stronger performance claims.

Related

Related work

Data-Driven Risk-Adjusted Performance Analysis →

Tests when a structural price-path score adds information beyond classical risk ratios, across market regimes.

Stability of Leveraged ETF Performance →

Shows how entry timing and volatility change compounded outcomes, a reminder that path and regime matter.

Project materials

Final report, source code and live application.

The student final report, the public repository and the deployed web application.

Outcome

A working research prototype, not a black-box “trading signal.”

TradeMind’s main contribution is the integration of probabilistic state modeling, simulation, transparent diagnostics, and a usable software interface into one end-to-end system.