Analysis Tools
Analysis tools operate on your trade history (R-multiples, equity values, P&L) to reveal the structure of your edge.
analyze_drawdown
Section titled “analyze_drawdown”Cost: $0.005 | Analyze drawdown periods from an equity curve.
| Parameter | Type | Required | Description |
|---|---|---|---|
equity_values | string[] | Yes | Equity after each trade (e.g. ["100000", "101500", "99800"]). |
starting_equity | string | Yes | Initial equity before the first trade. |
net_profit | string | No | Total net profit. Used for recovery factor calculation. |
result = client.call_tool( "analyze_drawdown", equity_values=["100000", "101500", "99800", "102000", "98500", "103000"], starting_equity="100000",)Returns: max_drawdown_pct, max_drawdown_usd, current_drawdown, avg_drawdown, drawdown_count, longest_duration, time_in_drawdown, recovery_factor, ulcer_index, drawdown_periods.
run_monte_carlo
Section titled “run_monte_carlo”Cost: $0.008 | Simulate future equity paths using historical R-multiples.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | Historical R-multiples (minimum 2). |
starting_equity | string | Yes | Starting equity for simulation. |
num_simulations | int | No | Number of simulations (default 1000, max 10000). |
trades_per_simulation | int | No | Trades per path (default 100). |
risk_per_trade | string | No | Risk fraction per trade (default "0.01"). |
result = client.call_tool( "run_monte_carlo", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0"], starting_equity="100000", num_simulations=5000,)Returns: probability_of_profit, probability_20pct_gain, probability_20pct_drawdown, probability_50pct_drawdown, median_final_equity, p5_final_equity, p95_final_equity, mean_final_equity, best_case, worst_case.
calculate_kelly
Section titled “calculate_kelly”Cost: $0.004 | Calculate Kelly criterion position sizing fractions.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history (minimum 2). |
result = client.call_tool( "calculate_kelly", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8"],)Returns: full_kelly, half_kelly (recommended), quarter_kelly (conservative), risk_of_ruin.
find_variance_killers
Section titled “find_variance_killers”Cost: $0.006 | Identify trades that damage geometric growth the most.
A variance killer is a trade whose deviation from the mean hurts G, even if individually profitable. High variance erodes geometric returns.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history (minimum 2). |
trade_ids | string[] | No | Trade identifiers (parallel to r_multiples). |
symbols | string[] | No | Symbols (parallel to r_multiples). |
result = client.call_tool( "find_variance_killers", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8", "-2.5"],)Returns: top 5 killers each with index, r_multiple, g_impact, variance_contribution, potential_g_improvement.
analyze_win_loss
Section titled “analyze_win_loss”Cost: $0.004 | Calculate win/loss statistics from R-multiples.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history. |
pnl_values | string[] | No | USD P&L per trade (parallel to r_multiples). |
result = client.call_tool( "analyze_win_loss", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8"],)Returns: win_rate, loss_rate, avg_win_r, avg_loss_r, avg_win_usd, avg_loss_usd, payoff_ratio, profit_factor, expectancy, net_pnl.
run_what_if
Section titled “run_what_if”Cost: $0.008 | Explore G improvement scenarios.
Shows how G would change if losses were capped at different levels, or if the worst trades were avoided.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history (minimum 2). |
result = client.call_tool( "run_what_if", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8", "-2.5"],)Returns: loss_cap_scenarios (G at -0.5R, -1R, -1.5R, -2R caps), avoidance_scenarios (G after removing worst 5%/10%/15%/20% of trades), top_variance_killers.
detect_regime
Section titled “detect_regime”Cost: $0.006 | Detect current market regime from OHLCV bars.
Classifies: TRENDING_UP, TRENDING_DOWN, RANGING, LOW_VOLATILITY, VOLATILE.
| Parameter | Type | Required | Description |
|---|---|---|---|
bars | object[] | Yes | OHLCV bars (minimum 200). Each bar has open, high, low, close, volume as strings. |
result = client.call_tool( "detect_regime", bars=[{"open": "150.00", "high": "152.00", "low": "149.50", "close": "151.50", "volume": "5000000"}, ...],)Returns: regime, trend_direction, trend_strength, volatility_state, volatility_percentile, atr.
analyze_confidence
Section titled “analyze_confidence”Cost: $0.005 | Confidence interval analysis on R-multiples. Returns mean, standard deviation, and confidence bounds at 90%, 95%, and 99% levels.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
analyze_consistency
Section titled “analyze_consistency”Cost: $0.005 | Measure trading consistency. Compares recent performance windows to detect behavioral drift.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
analyze_correlation
Section titled “analyze_correlation”Cost: $0.005 | Correlation analysis between R-multiples and external factors. Detects serial correlation in trade outcomes.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
analyze_distribution
Section titled “analyze_distribution”Cost: $0.005 | Analyze the statistical distribution of R-multiples. Returns skewness, kurtosis, normality test, percentiles, and tail risk.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
analyze_recovery
Section titled “analyze_recovery”Cost: $0.005 | Analyze recovery patterns after drawdowns. Returns average recovery time, recovery R needed, and worst recovery period.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
analyze_risk_adjusted
Section titled “analyze_risk_adjusted”Cost: $0.005 | Risk-adjusted return metrics. Returns Sharpe-like ratio, Sortino equivalent, Calmar ratio, and risk-adjusted G.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
segment_trades
Section titled “segment_trades”Cost: $0.005 | Analyze G metrics by segment to find where your edge lives.
| Parameter | Type | Required | Description |
|---|---|---|---|
trades | object[] | Yes | Trade objects with pnl_r, pnl_usd, and optional symbol, day_of_week, strategy_id, regime. |
segment_by | string | No | Dimension: "symbol", "day_of_week", "strategy", "regime". Default "symbol". |
result = client.call_tool( "segment_trades", trades=[ {"pnl_r": "1.5", "pnl_usd": "750", "symbol": "AAPL"}, {"pnl_r": "-0.8", "pnl_usd": "-400", "symbol": "MSFT"}, {"pnl_r": "2.0", "pnl_usd": "1000", "symbol": "AAPL"}, ], segment_by="symbol",)Returns per-segment: g, expected_r, variance, win_rate, total_pnl, helps_g (bool).
analyze_execution_quality
Section titled “analyze_execution_quality”Cost: $0.005 | Analyze trade execution using MAE/MFE analysis.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history. |
mae_values | string[] | No | Maximum Adverse Excursion in R. |
mfe_values | string[] | No | Maximum Favorable Excursion in R. |
hold_times_hours | string[] | No | Hold time in hours per trade. |
Returns: avg_mae_r, avg_mfe_r, entry_efficiency, exit_efficiency, avg_winner_hold_time, avg_loser_hold_time.
detect_peak_valley
Section titled “detect_peak_valley”Cost: $0.005 | Detect peaks and valleys in an equity curve.
| Parameter | Type | Required | Description |
|---|---|---|---|
equity_values | string[] | Yes | Equity values after each trade. |
starting_equity | string | Yes | Initial equity. |
Returns: ath_count, atl_depth, avg_peak_to_valley_drop, avg_valley_to_peak_gain, current_state (AT_PEAK, AT_VALLEY, BETWEEN).
calculate_rolling_g
Section titled “calculate_rolling_g”Cost: $0.005 | Calculate rolling G over sliding windows to track edge evolution.
| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history (minimum 2). |
window_size | int | No | Rolling window size (default 10). |
result = client.call_tool( "calculate_rolling_g", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8"], window_size=5,)Returns: rolling_g_values, trend (IMPROVING, STABLE, DECLINING), trend_slope.
calculate_system_r_score
Section titled “calculate_system_r_score”Cost: $0.005 | Calculate the System R Score (0 to 100 composite grade) from R-multiples.
| Parameter | Type | Required |
|---|---|---|
r_multiples | string[] | Yes |
Returns: score (0 to 100), grade (A+ through F), components breakdown.