Transparency

Methodology

How YouStockAI analyses stocks, computes probabilities, and generates insights

Transparency is core to YouStockAI. This page explains exactly how each feature works — the data we use, the calculations we perform, and the limitations you should be aware of when interpreting results.

1. Data Sources

  • Market Price Data: Historical OHLCV (Open, High, Low, Close, Volume) data for NSE-listed equities is sourced via the yfinance library, which fetches data from Yahoo Finance. Data may be delayed by 15–20 minutes during market hours and represents adjusted prices accounting for splits and dividends.
  • Universe: The screener and analysis engine covers NSE-listed equities in the Nifty 750 universe (Nifty 500 + microcap 250) — the 750 largest companies by market capitalisation on the National Stock Exchange of India.
  • Indices: NIFTY 50, NIFTY BANK, and India VIX data is also sourced via yfinance for the market overview panel.
  • News Sentiment: Financial news for relevant stocks is fetched from RSS feeds and processed by the Anthropic Claude AI model to derive a qualitative sentiment signal (Positive / Neutral / Negative).
  • Fundamental Data: Financial ratios (PE, PB, Debt/Equity, ROE, Revenue Growth) are sourced from Yahoo Finance via yfinance and cached weekly to reduce latency.

2. The WAVE & TIDE Framework

YouStockAI uses a multi-timeframe (MTF) analysis approach — reading two timeframes simultaneously for every stock to separate short-term noise from macro trend direction.

TIDE (Macro Direction)
The longer timeframe (Weekly for Swing, Monthly for Long Term). Uses MACD to determine the prevailing macro trend direction — bullish or bearish.
WAVE (Entry Timing)
The shorter timeframe (Daily for Swing, Weekly for Long Term). Uses Stochastic oscillator crossovers to time entry — positive crossover (K above D) signals potential momentum.

A signal is considered higher quality when TIDE and WAVE are in agreement — macro trend and short-term momentum pointing in the same direction.

3. Technical Indicators Used

MACD (12, 26, 9)
Moving Average Convergence Divergence. Bullish when MACD line is above signal line. Used as the primary TIDE direction indicator.
Stochastic (14, 3, 3)
%K and %D lines. A positive crossover (K crossing above D) in a bullish zone signals potential entry. Used as the WAVE timing indicator.
EMA (5 / 13 / 26)
Exponential Moving Averages. Bullish alignment: EMA5 > EMA13 > EMA26. Bearish: reverse order. Mixed signals are flagged as neutral.
RSI (14)
Relative Strength Index. Above 60 = momentum zone, 30–60 = neutral, below 30 = oversold. Overbought (above 70) may indicate caution.
ADX (14)
Average Directional Index. Above 25 indicates a strong trend; below 15 suggests a ranging market. DI+ vs DI– indicates directional bias.
Bollinger Bands (20, 2)
20-period SMA ± 2 standard deviations. Shows price position within the band as a percentile (0–100%). Extremes indicate potential mean reversion.
Volume Ratio
Current day volume divided by the 20-day average volume. Values above 1.5 indicate elevated participation; below 0.7 suggests thin trading.
Convergence Score
Counts how many of the 7 indicators point in the same direction. Higher convergence = stronger consensus. Displayed as "X of 7 aligned."

4. Stock Screener

The screener allows you to select any combination of up to 7 technical conditions and find NSE-listed stocks that currently meet those conditions. The process:

1

Condition Selection

You select which indicators to filter on — MACD bullish, EMA aligned, RSI in zone, etc.

2

Live Data Fetch

Daily OHLCV data for Nifty 750 stocks is fetched in parallel from yfinance. Pre-cached nightly results are used when available to reduce latency.

3

Indicator Computation

All 7 indicators are computed for each stock using the TA (Technical Analysis) library. Stocks are evaluated against your selected conditions.

4

Results Returned

Matching stocks are returned with their indicator values and outcome probability attached. No ranking by "best" — you interpret the results.

5. Outcome Probability Engine

This is one of YouStockAI's most distinctive features. When you view a stock, we calculate a historical probability based on how similar technical setups performed in the past.

How it works:

  • We look back 3 years of daily price history for the stock (5 years for Pro users).
  • We identify all trading days where the same combination of technical conditions was true (e.g., MACD bullish + EMA aligned).
  • For each such day, we measure whether the stock's closing price was higher or lower 5 trading days later.
  • We count the percentage of instances that resulted in a positive 5-day return and the average gain in up-scenarios and average loss in down-scenarios.

Interpretation: A result of "63% of 45 similar setups moved up in 5 days, average gain +3.2%, average loss -2.1%" means exactly what it says — a historical statistical distribution. It is descriptive, not predictive. The next instance may or may not follow this pattern.

Minimum sample size: We require at least 15 similar setups to report a probability. If fewer exist, we display "Insufficient historical data."

5a. Confidence Interval

Every outcome probability is accompanied by a 95% confidence interval, calculated using the Wilson score interval — a method specifically designed for binomial proportions that remains accurate even with small sample sizes (unlike the naive ±√(pq/n) formula).

For example: "46.7% ± 14.0% (95% CI: 32.9%–60.9%, 45 samples)" means we are 95% confident the true probability lies between 32.9% and 60.9%. The band width is labelled:

  • Tight (± 5% or less): High confidence — large sample size, narrow range.
  • Moderate (± 5–10%): Reasonable confidence — interpret with some caution.
  • Wide (± 10%+): Low confidence — small sample, treat the headline probability as a rough guide only.

This is deliberate honesty: we show you exactly how much uncertainty exists in each probability, rather than presenting a single number as fact.

5b. Outcome Distribution

Beyond the headline "X% moved up," we display a 6-bucket distribution histogram showing how the outcomes were actually spread:

  • Up > 5% — Strong positive move
  • Up 3–5% — Moderate positive move
  • Up 1–3% — Mild positive move
  • Flat (±1%) — Negligible change
  • Down 1–3% — Mild decline
  • Down > 3% — Significant decline

This prevents a misleading headline — "65% moved up" sounds strong, but if most of those moves were +0.5% while the down moves averaged -4%, the distribution reveals the risk-reward skew that the headline conceals.

5c. Last 5 Similar Setups

For every stock detail view, we show the 5 most recent historical dates where the exact same conditions were true, along with what actually happened: entry price, exit price, percentage change, and maximum drawdown during the holding period. This turns abstract probabilities into concrete, verifiable cases. Each row includes:

  • Date: When the condition was last true
  • Entry/Exit price: Closing price on the trigger date and 5 trading days later
  • Max drawdown: The worst intra-period dip before the exit date
  • Win rate & average move: Summarised from the displayed instances

This feature exists specifically so you can fact-check the probability engine against individual cases.

5d. Condition-Level Historical Proof

Each triggered condition in the "Why Did This Stock Appear?" explanation includes a proof line — a single-condition backtest showing how that specific indicator performed historically for this stock. For example: "When RSI dropped below 30 for ITC over 3 years, 64% saw price move up within 5 days (127 instances)."

This lets you evaluate which conditions carry weight individually, not just in combination.

6. AI Stock Story (Claude AI)

The Stock Story feature uses the Anthropic Claude Sonnet model to generate a 3-paragraph plain-English summary of what the technical indicators and historical data currently show for a stock. The AI is given:

  • Current indicator readings (MACD, EMA, RSI, ADX, Volume, Bollinger)
  • Outcome probability statistics
  • Any available news sentiment summary

The AI operates under strict SEBI-compliance rules embedded in its system prompt — it is explicitly instructed to never use words like "buy," "sell," "target price," or "stop-loss," and to frame all historical data as statistics rather than forecasts. All AI output is additionally filtered through an automated word-boundary check before being displayed.

Stories are cached for 24 hours per stock to reduce API costs and improve response times.

7. Chart Pattern Detection

YouStockAI scans for 17 chart patterns on each stock's daily price data. Patterns are detected algorithmically using price geometry — no subjective interpretation. Each detected pattern includes a confidence score (0–100%), signal direction (bullish/bearish), and key price levels extracted from the pattern structure.

Double Bottom
Two troughs at approximately the same level, separated by a peak. Bullish reversal pattern. Key levels: trough level, neckline.
Double Top
Two peaks at approximately the same level, separated by a trough. Bearish reversal pattern. Key levels: peak level, neckline.
Three White Soldiers
Three consecutive strong bullish candles with progressively higher closes. Signals momentum continuation.
Three Black Crows
Three consecutive bearish candles with progressively lower closes. Signals momentum reversal downward.
Genuine Breakout
Price closes above a previously tested resistance level on above-average volume. Key level: resistance broken.
Genuine Breakdown
Price closes below a previously tested support level on above-average volume. Key level: support broken.
Fake Breakout (Bull Trap)
Price briefly breaks above resistance but fails to hold, falling back below. Bearish signal.
Fake Breakdown (Bear Trap)
Price briefly breaks below support but recovers above it. Bullish signal — sellers trapped.
Cup and Handle
U-shaped recovery followed by a small consolidation (handle). Bullish continuation pattern.
Rounding Bottom / Top
Gradual curve in price forming a bowl (bottom) or dome (top). Signals slow trend reversal.
Mother Candle
A large candle at a key support or resistance level that engulfs several prior candles. Bullish or bearish depending on location.
Gap Up / Gap Down
Price opens significantly above (gap up) or below (gap down) the previous close. Key levels: gap level, gap percentage.
Flag and Pole
A strong directional move (pole) followed by tight consolidation (flag). Continuation pattern.
Counter Attack
Bulls or bears counter attack — an opposing candle of similar magnitude that reverses the prior day's move.

Invalidation conditions: Each pattern includes a specific invalidation criterion — the price level at which the pattern's thesis weakens. For example, a Double Bottom's thesis weakens if price closes below the trough level.

"What Happened Last Time": For each detected pattern, we show the most recent historical instance where the same pattern was detected on the same stock, and the actual outcome — entry price, exit price, and percentage change. This provides concrete evidence for or against the pattern's reliability on that specific stock.

8. Support & Resistance Zones

Historical price zones are calculated by finding significant pivot highs and lows in the stock's price history using a swing-point detection algorithm. These zones represent price levels where the stock has historically found buying or selling interest. They are presented as data points — not as targets or stop-loss recommendations.

9. Sector Relative Strength

When viewing a stock's detail, we compare its daily price change against two benchmarks:

  • Sector peers: The average daily change of up to 15 stocks in the same sector (based on our 750-stock sector classification map covering 25+ sectors).
  • NIFTY 50: The benchmark index for the Indian equity market.

This context answers a critical question: is this stock moving because of its own merit, or is the entire sector (or entire market) moving?

A stock showing +2.5% when its sector averages +2.3% and NIFTY is +2.0% is largely riding a market wave. A stock showing +2.5% when its sector is -0.3% and NIFTY is flat is demonstrating genuine relative strength.

The verdict label — Outperforming, In-line, or Underperforming — is based on the stock's deviation from its sector average (±1% threshold). Sector data is cached for 60 seconds to balance freshness with performance.

10. Mini Price Charts

Each stock detail panel includes a 60-day candlestick chart rendered using the TradingView Lightweight Charts library. This is a read-only visualization — scrolling and zooming are disabled by design because this is a data proof chart, not a trading tool.

Pattern annotations: When chart patterns are detected, they are overlaid on the chart as:

  • Price lines: Key levels from the pattern (neckline, support/resistance, gap levels) shown as dashed horizontal lines with labels.
  • Markers: Arrow indicators on the most recent candle showing the pattern's signal direction (bullish ▲ or bearish ▼).

The chart uses OHLCV data from the same yfinance source as all other analysis — no separate data feed.

11. Data Traceability

Every stock detail panel includes a collapsible data provenance badge showing:

  • Data as of: The timestamp of the most recent price data used in the analysis.
  • Analysis period: How many years of history were used for the outcome probability calculation.
  • Sample size: The number of historical setups that matched the selected conditions.
  • Source: NSE via yfinance — our data pipeline.
  • Exchange: National Stock Exchange (India).

This exists so you can verify when the data was last refreshed and how much history backs any statistic we display.

12. Pattern Consistency Tracking

Every time the Outcome Probability Engine shows a historical claim ("63% of similar setups moved up"), we log that observation. After the horizon window passes (typically 5 trading days), we fetch the actual closing price and check whether the historical pattern held.

The Pattern Consistency Dashboard displays:

  • Consistency rate: What percentage of historical patterns continued to hold in subsequent instances.
  • Historical claim vs actual: Side-by-side comparison of what historical data showed versus what actually happened.
  • Per-condition breakdown: Which technical conditions have the most and least consistent track records.
  • Monthly trends: How consistency varies over time.
  • Most consistent and largest deviations: The specific stocks where patterns held best and where they deviated most — because hiding inconsistencies defeats the purpose.

Observations are deduplicated (same stock + conditions on the same day = one entry) and verified automatically. This is a forward-looking consistency tracker — it measures whether historical patterns continue to hold in real time, not just in hindsight. This is not a prediction scorecard — we do not predict, recommend, or advise.

13. Known Limitations

  • Data delay: yfinance data may lag real-time NSE prices by 15–20 minutes or more. Do not use for last-second trading decisions.
  • Corporate actions: Recent splits, bonuses, or rights issues may not be reflected immediately in adjusted prices.
  • Survivorship bias: The Nifty 750 universe excludes delisted or suspended companies, which may slightly skew historical outcome statistics.
  • Low-liquidity stocks: Technical indicators are less reliable for thinly traded stocks where volume is consistently very low.
  • AI errors: AI-generated stock stories may occasionally mischaracterise indicator readings. Always verify against the raw indicator values shown in the analysis panel.
  • Confidence intervals: The Wilson score interval is mathematically rigorous, but assumes historical conditions are independent events — which is not strictly true for stocks (today's RSI below 30 often persists for several consecutive days, inflating sample count). Treat wide-band CIs with extra caution.
  • Sector comparison: Sector averages are based on the top 15 peers by market cap in our classification. Uneven sector sizes and some tickers lacking same-day data may skew the average slightly.
  • Pattern detection: Chart patterns are detected algorithmically with fixed geometric thresholds. The same chart may be interpreted differently by human analysts. A detected pattern is an observation, not a forecast.
  • Historical instances: "Last 5 Similar Setups" shows the 5 most recent matches — not the 5 best or worst. The selection is purely chronological. Past instances do not predict the next occurrence.