mcpbeat Sign in

Optimize Agent Skill

Optimize strategy parameters using VectorBT. Tests parameter combinations and generates heatmaps.

758 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
183
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/marketcalls/vectorbt-backtesting-skills --skill optimize

The instruction itself

4 sections, as written by the author

Create a parameter optimization script for a VectorBT strategy.

Arguments

Parse $ARGUMENTS as: strategy symbol exchange interval

  • $0 = strategy name (e.g., ema-crossover, rsi, donchian). Default: ema-crossover
  • $1 = symbol (e.g., SBIN, RELIANCE, NIFTY). Default: SBIN
  • $2 = exchange (e.g., NSE, NFO). Default: NSE
  • $3 = interval (e.g., D, 1h, 5m). Default: D

If no arguments, ask the user which strategy to optimize.

Instructions

  • Read the vectorbt-expert skill rules for reference patterns
  • Create backtesting/{strategy_name}/ directory if it doesn't exist (on-demand)
  • Create a .py file in backtesting/{strategy_name}/ named {symbol}_{strategy}_optimize.py
  • The script must:
  • Load .env from project root using find_dotenv() and fetch data via OpenAlgo client.history()
  • If user provides a DuckDB path, load data directly via duckdb.connect(path, read_only=True). See vectorbt-expert rules/duckdb-data.md.
  • If openalgo.ta is not importable (standalone DuckDB), use inline exrem() fallback.
  • Use OpenAlgo ta for ALL indicators by default (never VectorBT built-in). Only switch to TA-Lib if the user explicitly says "talib"/"TA-Lib"
  • Always use OpenAlgo ta for specialty indicators (Supertrend, Donchian, etc.) - no TA-Lib equivalent exists
  • Use ta.exrem() to clean signals (always .fillna(False) before exrem)
  • Define sensible parameter ranges for the chosen strategy
  • Use loop-based optimization to collect multiple metrics per combo
  • Track: total_return, sharpe_ratio, max_drawdown, trade_count for each combination
  • Use tqdm for progress bars
  • Indian delivery fees: fees=0.00111, fixed_fees=20 for delivery equity
  • Find best parameters by total return AND by Sharpe ratio
  • Print top 10 results for both criteria
  • Generate Plotly heatmap of total return across parameter grid (template="plotly_dark")
  • Generate Plotly heatmap of Sharpe ratio across parameter grid
  • Fetch NIFTY benchmark and compare best parameters vs benchmark
  • Print Strategy vs Benchmark comparison table
  • Explain results in plain language for normal traders
  • Save results to CSV
  • Never use icons/emojis in code or logger output
  • For futures symbols, use lot-size-aware sizing:
  • NIFTY: min_size=65, size_granularity=65
  • BANKNIFTY: min_size=30, size_granularity=30

Default Parameter Ranges

| Strategy | Parameter 1 | Parameter 2 |

|----------|------------|-------------|

| ema-crossover | fast EMA: 5-50 | slow EMA: 10-60 |

| rsi | window: 5-30 | oversold: 20-40 |

| donchian | period: 5-50 | - |

| supertrend | period: 5-30 | multiplier: 1.0-5.0 |

Example Usage

/optimize ema-crossover RELIANCE NSE D

/optimize rsi SBIN

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take marketcalls/optimize from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.