Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+23 more

    Backtest Audit

    by Hale Sinclair

    1

    - flags.py: four flags, exit 1 if any: too few trades for claims, profit resting on few trades, a win rate that falls apart out of sample, costs that turn the result negative.

    $9.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Backtest Audit

    Backtest Audit

    Example session with this skill installed

    Audit this backtest log: how many trades, what the drawdown is, whether a few trades carry the profit, and what costs do.

    • Read your context and instructions
    • Compiled the backtest audit

    Sample result: audit of a synthetic backtest log (synthetic input, built to raise flags)

    stats.py

    backtest log: synthetic-lucky.csv (layout: plain, 36 results)
    trades              36
    win rate            38.9 %  (14 wins, 22 losses, 0 flat)
    average win         204.24
    average loss        -35.91
    expectancy/trade    57.48
    profit factor       3.62
    total result        2069.36
    largest drawdown    -571.08 over 19 trades
    exposure            n/a (the log has no entry and exit times)
    longest losing run  8 trades
    This measures the log; it recommends no trade and predicts nothing.
    

    stress.py

    stress of synthetic-lucky.csv (layout: plain, 36 results)
    as logged        result 2069.36, expectancy 57.48
    after costs      cost 30.00 + slippage 10.00 per trade: result 629.36, expectancy 17.48, profit factor 1.33
    split (first / second half by count)
      first part     18 trades, win rate 61.1 %, result 2620.34, expectancy 145.57
      second part    18 trades, win rate 16.7 %, result -550.98, expectancy -30.61
    reshuffled 1,000 times (seed 12345): largest drawdown min -174.53, 5% -231.33, median -343.71, 95% -511.26, max -685.67; the log's own order: -571.08
    best five removed: result -656.19 (as logged 2069.36)
    This measures the log; it recommends no trade and predicts nothing.
    

    flags.py

    flags for synthetic-lucky.csv (layout: plain, 36 results)
    FLAG profit rests on few trades: the best five make 2725.55 of 2069.36; without them -656.19
    FLAG win rate falls apart out of sample (first / second half by count): 61.1 % then 16.7 %, result 2620.34 then -550.98
    ok   trades: 36
    ok   costs: 2069.36 as logged, 629.36 after cost and slippage
    result: 2 flag(s)
    This measures the log; it recommends no trade and predicts nothing.
    

    Reading: the total looks good (profit factor 3.6) but the best five trades make more than the whole profit, the second half loses, and 40 of cost and slippage per trade removes most of it. This describes the log; it recommends no trade and predicts nothing.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    A backtest ends in one flattering number. Behind it there may be 20 trades, three lucky ones carrying the profit, a second half that looks nothing like the first, or a result that disappears once costs are paid. Nobody redoes that arithmetic by hand.

    What it does

    Your agent reads the log and reports; three standard-library Python scripts do the arithmetic:

    • stats.py: number of trades, win rate, average win and loss, expectancy per trade, profit factor, largest drawdown and how many trades it lasted, exposure, longest losing run.
    • stress.py: the result after a cost and a slippage per trade (your flags), first half against second half or against a split date, the trades reshuffled 1,000 times with a fixed seed (the range of the largest drawdown), and the result with the best five trades removed.
    • flags.py: four flags, exit 1 if any: too few trades for claims, profit resting on few trades, a win rate that falls apart out of sample, costs that turn the result negative.

    It reads a CSV trade log (date,side,quantity,price,profit), a TradingView-style strategy export (Entry and Exit rows; a trade still open is left out and said) or an equity curve, finding the layout from the header; columns can be mapped with flags. Numbers may be written 1,234.50, 1.234,50, 1 234,50, 1'234.50, (12.5), -$3.50, 3-, 12.50 USD or 6.9e-05; the decimal mark is read from the column or named with --decimal, and a file it cannot read is refused by name, with every skipped row counted and its reason. Each script is one file that needs no other file. No model call, no network, no market data; it changes no file of your project and writes only the --out file you name.

    It measures a log. It recommends no trade and predicts nothing.

    What the check run proves

    • Four synthetic logs of different shape (all declared synthetic, seeded): a plain 240-trade log, a 36-trade log built to raise flags, a TradingView-style export of 80 trades and an equity curve. Trades, total, wins, expectancy, drawdown, longest losing run, the best-five-removed result and the after-cost total equal an independent count (awk) on the plain log.
    • Both directions: the lucky log raises the concentration and the out-of-sample flags (exit 1); the steady log, whose second half is better, raises none (exit 0); too few trades and costs that turn a profit negative are flagged.
    • Faults handled: a missing, locked or non-UTF-8 file is one line or one note, never a traceback; a column flag naming no column lists the columns; a header with no row, rows with no number, one trade, all wins and all losses do not crash; --out aimed at the log by 7 routes is refused; the reshuffle is the same on every run. Each guard is shown failing on a deliberately broken copy.
    • Files from other projects (reduced, with their sources in inputs/SOURCES.md): an equity curve and a returns file with an exponent value give trades, wins and total equal to awk's; a TradingView-header file with only Net P&L % is refused in one line and read with --profit-col.
    • Number formats, open trades, newest-first logs, empty and one-result logs, and --out aimed at the log are covered by 108 cases, each failing on the previous version of the scripts (checks/demo-round2.out).
    • The TradingView-style file is our imitation of the layout, not a file exported by TradingView: no real TradingView export has been seen.

    How it works

    1. Save the log as CSV.
    2. stats.py measures, stress.py stresses (ask what costs and slippage are; none are assumed), flags.py flags.
    3. The agent reports figures, flags and what was not tested, and never says a strategy works. Everything runs locally on Python 3.9+ standard library.

    Use cases

    • Check a backtest before trusting its headline number.
    • See what costs and slippage do to the result.
    • Find whether a few lucky trades carry the profit.
    • Compare the first half of a log with the second, or before and after a date.

    Known limitations

    • No check for look-ahead bias, survivorship or fitting to the data.
    • The reshuffle assumes independent trades; real drawdowns can be worse.
    • Exposure does not merge overlapping trades.
    • One unit, no currency conversion or position sizing. Money prints with 2 decimals, so a log of tiny fractions shows rounded figures. A % is dropped and said: the number before it is read as written.
    • No real TradingView export has been seen: the two TradingView-header files tested are another project's engine fixtures, and a real export with other headers may need --profit-col.
    • stress.py takes about 35 seconds per 100,000 trades on the author's machine (72 s on 200,000, measured); above 20,000 trades it says so on stderr first.
    • The out-of-sample flag cuts one log in two; it is not walk-forward testing.

    Measures a log: recommends no trade, predicts nothing, and passing every flag proves nothing about the future. Four test logs are synthetic; the TradingView-style file imitates the layout and no real TradingView export has been seen, so a real export with different headers may need --profit-col. Two reduced files from other projects were also read. Thresholds are rules of thumb, not statistical tests. Nobody has run it on a live strategy.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Software
    Python

    No accounts, API keys or services. Python 3.9+ on the machine.

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    File Scopes

    the
    trade
    log
    or
    equity
    curve
    (CSV)
    user
    names
    (read);
    output
    path
    gives
    with
    --out
    inside
    project
    directory
    Listedtoday

    What's inside

    Creator

    Hale Sinclair

    Hale Sinclair

    9 skills on Agensi

    Frequently Asked Questions

    No. It measures the log and raises flags; it recommends no trade and predicts nothing.

    CSV trade logs (date,side,quantity,price,profit), TradingView strategy exports (Entry and Exit rows) and equity curves; columns can be mapped with --date-col, --profit-col, --equity-col, and the decimal mark with --decimal point|comma.

    No. You give --cost and --slippage; with none given the costs flag is not tested and says so.

    No. It reads only the log you name and makes no network calls.

    No. It writes only the --out file you name and refuses to overwrite the log.

    New in Trading & Investing

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.