real math strategy backtest lab

    by nowrich

    1

    Rigorous historical backtesting for rule-based trading strategies with risk metrics and transaction cost analysis.

    Secure checkout via Stripe

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    See it in action

    You say

    Backtest a strategy in crypto_prices.csv: buy when 50 EMA crosses above 200 EMA, sell when it crosses below. Assume 0.1% slippage.

    Your agent does

    Backtest Results:

    • Total Return: 42.5%
    • Annualized Return: 12.2%
    • Sharpe Ratio: 1.45
    • Max Drawdown: -18.4%
    • Win Rate: 58% (42 trades)
    • Cost Impact: Returns reduced by 4.2% due to slippage. Interpretation: The Sharpe ratio suggests good risk-adjusted returns, but the 18% drawdown is significant.

    What you get

    Test rule-based entry and exit conditions against historical price data.Calculate Sharpe and Sortino ratios to evaluate risk-adjusted performance.Determine the exact impact of commissions and slippage on total returns.Identify maximum drawdown to assess potential portfolio risk.

    About this skill

    The problem

    Vague trading ideas often fail when exposed to real-world costs and historical volatility. Manual backtesting is slow, prone to look-ahead bias, and frequently ignores critical risk metrics like drawdown or slippage.

    What it does

    • Translates plain-language strategy rules into executable Python/pandas backtesting code.
    • Simulates entry/exit signals, position sizing, and stop-loss logic against historical OHLCV data.
    • Calculates risk-adjusted performance including Sharpe ratio, Sortino ratio, and Maximum Drawdown.
    • Quantifies the specific impact of transaction costs, commissions, and slippage on net returns.
    • Validates data integrity by checking for gaps, duplicates, and missing values before execution.

    Frameworks & tools

    Python, pandas, and NumPy for vectorization and performance metrics.

    Why this beats prompting it yourself

    Generic prompts often forget to account for transaction-cost drag or accidentally introduce look-ahead bias by using future data points in current signals. This skill enforces a rigorous simulation framework that isolates costs and calculates downside deviation for a realistic view of risk.

    Use cases

    • Backtesting moving average or RSI-based indicators on daily or intraday CSV data.
    • Analyzing the impact of a 0.1% commission fee on a high-frequency strategy.
    • Comparing the Sortino ratio of a long-only strategy versus one that includes short selling.
    • Identifying the maximum peak-to-trough decline to determine capital requirements.

    Known limitations

    Requires structured price data (timestamp, OHLCV). It does not fetch external market data; files must be provided or simulated.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Frequently Asked Questions

    Popular in Trading