Skip to content

Analyzes the raw statistical edge of trading indicators. Calculates true Win Rate, Drawdown, and Expectancy without money management bias

Notifications You must be signed in to change notification settings

nssanta/Stress-Test-Indicator

Repository files navigation

📊 Stress Test Indicator

Python 3.9+ License: MIT Pandas TA Precision

"A Backtester tells you 'What would have happened'. This Scanner tells you 'What is likely to happen'."


📜 The Manifesto: Why This Tool Exists

As a Quant Developer, I faced a recurring problem. I would design an indicator, put it into a backtester, and get a beautiful equity curve. But when I deployed it to live trading, it failed.

Why? Because standard backtesters are result-oriented. They simulate a fixed strategy (e.g., "Buy at X, Sell at Y"). They mask the inherent quality of the signal behind money management rules.

I realized I didn't need a Strategy Tester. I needed a Signal Auditor. I needed to know: "When this arrow appears, does the price physically move in my favor? Or is it just noise?"

This tool was built to aggregate statistics across thousands of signals to reveal the raw probability distribution of future price movements. It allows you to evaluate an indicator's "Edge" in its purest form, before you even think about risk management.


🛡️ The Methodology: Stress Testing

Stress Test Indicator performs a deep-dive forensic analysis on every signal.

  1. Signal Generation: It calculates indicators on your chosen timeframe (e.g., 1H, 4H).
  2. Micro-Granularity Drill-Down: It locates that exact moment in the 1-minute data.
  3. The "Future Cone": It looks forward 3, 6, 12... 96 bars and records everything that happened:
    • How far did it go up? (MFE)
    • How deep did it crash? (MAE)
    • Did it offer a chance to take profit before the crash?

This approach allows for Indicator Engineering. You stop guessing parameters. You run the scan, look at the data, and see: "Aha, RSI(14) has a 48% win rate, but RSI(9) has 62%."

Analysis Dashboard Figure 1: The Dashboard. Visualizing the statistical probability of success across different time horizons.


📊 The Data Dictionary: Understanding the Output

The stress_results.csv file is the heart of this project. It contains the aggregated DNA of every strategy tested. Here is the complete guide to every column:

Column Description & Usage
timeframe The timeframe where the signal was generated (e.g., 15min, 1h).
Usage: Compare if a strategy works better on Scalping (5m) or Swing (4h) frames.
indicator The specific technical indicator algorithm used (e.g., rsi, macd, bbands).
params_json The Configuration DNA. The exact parameters used (e.g., {"length": 14, "scalar": 100}).
Usage: Crucial for optimization. Allows you to pinpoint exactly WHICH settings created the edge.
horizon The forecast window in bars (e.g., 12).
Usage: Tells you how long the "predictive power" of the signal lasts.
signal_count The sample size. Total valid signals found in history.
Usage: Confidence level. 10 signals = Luck. 1000 signals = Statistically Significant Edge.
mean_plus Mean Favorable Excursion (MFE). The average % profit potential of the signal.
Usage: Your baseline expectation. If this is < 0.2%, spread/fees will eat your profit.
best_plus The single best trade return recorded in the sample.
Usage: Shows the "Black Swan" upside potential (the Jackpot trade).
mean_drawdown Mean Adverse Excursion (MAE). The average % the price goes against you.
Usage: The "Pain Threshold". You must be mentally prepared to see this loss on screen.
worst_drawdown The Stress Test. The absolute worst price drop immediately after entry.
Usage: Stop Loss Sizing. If your SL is tighter than this, you would have been liquidated.
tp_50pct The profit level reached in ≥ 50% of cases.
Usage: A high-probability, conservative Take Profit target (Coin flip).
tp_80pct The profit level reached in ≥ 80% of cases.
Usage: The "Bread and Butter" target. Ideal for automated scalping bots.
tp_90pct The profit level reached in ≥ 90% of cases.
Usage: Sniper entry. Very small profit, but extremely high hit rate.
tp_100pct The profit level reached in 100% of cases (Minimum MFE).
Usage: The guaranteed move. Often 0 or negative if some trades go straight down.
mean_min_take The average profit available before the drawdown started.
Usage: Timing optimization. Tells you if you should take profit quickly or hold.
max_min_take The maximum profit available before the drawdown started.
Usage: Identifies "Perfect Entry" scenarios where price never looked back.

🛠️ Installation & Usage

1. Setup Environment

git clone https://github.com/nssanta/Stress-Test-Indicator.git
cd Stress-Test-Indicator
pip install -r requirements.txt

2. Run the Scanner

Ensure BTCUSDT_1m.csv is in the root folder.

python stress_pipeline.py

The engine resamples 1m data to target TFs, calculates all indicators, and runs the stress matrix.

3. Analyze the "Golden Combinations"

python analyze_results.py

Outputs the top performing strategies based on Risk/Reward ratios.


⚠️ Disclaimer

This software is a research tool for quantitative analysis. It provides statistical probabilities, not financial guarantees. Past performance is not indicative of future results.

About

Analyzes the raw statistical edge of trading indicators. Calculates true Win Rate, Drawdown, and Expectancy without money management bias

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages