Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@kwasati/strategylab

kwasati39MIT1.1.5

AI-Powered EA Development Framework for MetaTrader 5 - Claude Code Edition (New Architecture)

trading, metatrader, mt5, mt4, ea, forex, ai, claude, claude-code, superclaude, strategylab

readme

StrategyLab Framework v1.1.0

npm version License: MIT Python

███████╗████████╗██████╗  █████╗ ████████╗███████╗ ██████╗██╗   ██╗    ██╗      █████╗ ██████╗ 
██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚██╗ ██╔╝    ██║     ██╔══██╗██╔══██╗
███████╗   ██║   ██████╔╝███████║   ██║   █████╗  ██║  ███╗╚████╔╝     ██║     ███████║██████╔╝
╚════██║   ██║   ██╔══██╗██╔══██║   ██║   ██╔══╝  ██║   ██║ ╚██╔╝      ██║     ██╔══██║██╔══██╗
███████║   ██║   ██║  ██║██║  ██║   ██║   ███████╗╚██████╔╝  ██║       ███████╗██║  ██║██████╔╝
╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚══════╝ ╚═════╝   ╚═╝       ╚══════╝╚═╝  ╚═╝╚═════╝ 
                                                                    ᴇxᴘᴇʀᴛ ᴀᴅᴠɪsᴏʀ ғᴀᴄᴛᴏʀʏ

🚨 Major Update: New Architecture in v1.1.0

BREAKING CHANGE: StrategyLab v1.1.0 introduces a new architecture that separates framework files from user data:

  • Framework Files: ~/.claude/StrategyLab/ (read-only)
  • User Data: ~/StrategyLab/ (your files)

This change ensures clean uninstallation, easier updates, and better data protection.

🎯 Overview

StrategyLab Framework เป็นเครื่องมือสำหรับพัฒนา Expert Advisor (EA) บน MetaTrader 5 ด้วยพลังของ AI จาก Claude Code ช่วยให้คุณสร้าง trading strategies ได้อย่างง่ายดายผ่านการสนทนาภาษาธรรมชาติ

✨ What's New in v1.1.0

🏗️ Architecture Redesign

  • Clean Separation: Framework files separate from user data
  • Safe Updates: Update framework without touching your data
  • Better Uninstall: Remove framework while preserving your work

🔄 Automatic Migration

  • Smart Detection: Automatically detects v1.0.x installations
  • Safe Migration: Backs up before moving files
  • Zero Data Loss: All your ideas, plans, and strategies preserved

🛠️ Improved Installation

  • One Command: npm install -g @kwasati/strategylab
  • Auto Migration: Handles upgrade from v1.0.x automatically
  • Progress Tracking: Clear visual feedback during installation

✨ Key Features

🧠 AI-Powered Intelligence

  • Strategy Generation: AI สร้าง trading strategies จากไอเดียง่ายๆ ของคุณ
  • Deep Analysis: Sequential thinking สำหรับการวิเคราะห์เชิงลึก
  • Smart Planning: วางแผนการพัฒนา strategy อย่างเป็นระบบ
  • Code Generation: สร้างโค้ด EA อัตโนมัติตาม best practices

🌐 Multi-Language Support

  • ภาษาไทย: รองรับการใช้งานภาษาไทยเต็มรูปแบบด้วย --lang TH
  • English: ภาษาเริ่มต้นสำหรับผู้ใช้ทั่วโลก

📊 Trading Personas (5 บุคลิกภาพ)

  • quant-trader: นักวิเคราะห์เชิงสถิติและ systematic trading
  • risk-manager: ผู้เชี่ยวชาญด้านการจัดการความเสี่ยงและการรักษาเงินทุน
  • ea-developer: ผู้เชี่ยวชาญ MQL5 และการ optimize โค้ด
  • analyzer: นักวิเคราะห์ root cause และการวางแผน
  • scribe: ผู้เชี่ยวชาญด้านการเขียนเอกสารและการจดบันทึก

🚀 Installation

For New Users

npm install -g @kwasati/strategylab

For Existing Users (v1.0.x)

The installer will automatically:

  1. Detect your existing installation
  2. Prompt for migration
  3. Back up your data
  4. Move framework files to new location
  5. Keep your user data in place

📁 New Directory Structure

Framework Files (Read-Only)

~/.claude/StrategyLab/
├── scripts/          # All Python scripts
├── knowledge/        # Trading knowledge base
├── config/           # Configuration files
└── templates/        # EA templates and Core modules

User Data (Your Files)

~/StrategyLab/
├── ideas/            # Your strategy ideas
│   ├── current/
│   ├── used/
│   └── archived/
├── planning/         # Your strategy plans
│   ├── ready/
│   ├── used/
│   └── archived/
├── strategies/       # Generated EAs
└── notes/           # Your notes
    ├── active/
    ├── archived/
    └── exports/

🛠️ Core Commands

Claude Code Commands

/strategylab          # Main command
/ea:help             # Show help
/ea:idea             # Generate ideas
/ea:plan             # Create plans
/ea:create           # Generate EA
/ea:note             # Manage notes

Command Line Usage

sl idea              # Generate trading ideas
sl plan              # Manage strategy plans
sl create            # Create EA from plan
sl note              # Manage notes

Supported Flags

  • --lang TH|EN - เลือกภาษา (ไทย/อังกฤษ)
  • --think - วิเคราะห์แบบละเอียด (4K tokens)
  • --think-hard - วิเคราะห์แบบลึกมาก (10K tokens)
  • --mt4/--mt5 - เลือก platform (default: MT5)

📋 Requirements

  • Python 3.8+
  • Claude Code CLI
  • MetaTrader 5
  • 4GB RAM minimum
  • 100MB disk space

🔄 Upgrading from v1.0.x

What Happens During Migration

  1. Backup: Creates timestamped backup of your current installation
  2. Move Framework: Moves scripts, knowledge, config, templates to ~/.claude/StrategyLab/
  3. Preserve User Data: Keeps your ideas, plans, strategies, notes in ~/StrategyLab/
  4. Update Paths: All scripts updated to use new paths
  5. Validate: Checks that everything works correctly

Migration Safety

  • Automatic Backup: Before any changes
  • Dry Run Option: Preview changes without making them
  • Rollback: Can restore from backup if needed
  • Zero Data Loss: All your work is preserved

🐛 Troubleshooting

Migration Issues

If migration fails:

# List available backups
sl migrate --list-backups

# Restore from backup
sl migrate --restore [backup_path]

Permission Errors

If you get permission errors:

# Check permissions
ls -la ~/.claude/

# Fix permissions if needed
chmod 755 ~/.claude

Command Not Found

After installation:

  1. Restart Claude Code
  2. Check that /strategylab command is available
  3. Try /ea:help to verify installation

📝 Documentation

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Claude AI by Anthropic for powering the intelligence
  • MetaTrader 5 community for trading insights
  • All contributors and users of StrategyLab

Note: This is a breaking change from v1.0.x. Please ensure you have backups before upgrading.

changelog

StrategyLab Framework Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.1.5] - 2025-08-05

Fixed

  • Critical Path Bug: Fixed user data path from ~/StrategyLab to ./StrategyLab (current directory)
  • Path Manager: Major improvements to ensure all user data saves in project directory
  • Initialization Order: Fixed AttributeError by reordering path initialization

Changed

  • User Data Path: Now consistently uses ./StrategyLab for all user data
  • Package.json: Updated user_data path from ~/ to ./
  • Version: Updated to 1.1.5 in all files

Removed

  • Migration Code: Removed unnecessary migration functionality (no production users yet)

[1.1.4] - 2025-08-05

Fixed

  • strategylab.md Command: Rewrote to be lean and functional with clear execution steps
  • Command Clarity: Removed confusing auto-mapping and framework intelligence sections
  • Execution Flow: Simplified to show exactly what AI should execute

Changed

  • What It Does Section: Now shows specific bash commands to run
  • Examples: Simplified to show realistic usage patterns
  • Documentation: Focused on actual functionality vs promised features

[1.1.3] - 2025-08-04

Fixed

  • File Structure Bug: Fixed user data being created in ~/StrategyLab instead of ./StrategyLab (current directory)
  • Directory Creation: Commands now correctly create project structure in the current working directory

Added

  • File Structure Script: New /scripts/file_structure.py dedicated to directory structure management
  • Structure Modes: Support for --ensure, --check, and --clean operations
  • Current Directory: User data now properly isolated per project

Changed

  • Initialization: Updated bin/strategylab to use file_structure.py instead of path_manager.py --init
  • Documentation: Updated commands documentation to reflect new structure creation

[1.1.2] - 2025-08-04

Fixed

  • Uninstaller Bug: Fixed uninstaller not removing /strategylab command file (~/.claude/commands/strategylab.md)
  • Uninstall Script: Created proper uninstall.py script with comprehensive removal logic
  • Command Update: Updated uninstall.md to properly reference and execute the uninstall script

Added

  • Uninstall Script: New /scripts/uninstall.py with proper error handling and safety features
  • Complete Removal: Uninstaller now properly removes all StrategyLab files including main command

1.1.0 - 2025-08-04

🚨 BREAKING CHANGES

This is a major architectural change that affects all users. The framework has been redesigned to separate framework files from user data.

New Directory Structure

  • Framework Files: ~/.claude/StrategyLab/ (read-only)
  • User Data: ~/StrategyLab/ (read/write)

No Migration Required

  • Fresh architecture for all users
  • No v1.0.x users in production

Added

  • New Architecture: Complete separation of framework and user data
  • Simplified Path Management: Consolidated to path_manager.py
  • Clean Installation: No migration complexity
  • Better Installation: Streamlined installer without migration complexity
  • Command Line Tool: sl command for easy access
    • sl idea - Generate trading ideas
    • sl plan - Manage strategy plans
    • sl create - Create EA from plan
    • sl note - Manage notes

Changed

  • Installation Path: Framework now installs to ~/.claude/StrategyLab/
  • User Data Path: User data remains in ~/StrategyLab/
  • All Scripts Updated: All Python scripts updated to use new paths
  • Config Structure: Updated configuration to support new architecture
  • Package Structure: Reorganized package files for cleaner distribution

Removed

  • Migration System: Removed unnecessary migration code (no v1.0.x users)
  • Path Manager Versioning: Simplified from path_manager_v1_1_0.py to path_manager.py
  • Package Cruft:
    • Removed colorama from npm dependencies (Python package)
    • Removed non-existent main: index.js reference
    • Removed migration_required flag
    • Cleaned duplicate file entries in package.json

Fixed

  • Uninstall Safety: Framework can be uninstalled without losing user data
  • Update Issues: Framework updates no longer risk overwriting user files
  • Path Conflicts: Clear separation prevents path-related issues
  • Permission Problems: Better handling of directory permissions

Security

  • Read-Only Framework: Framework files protected from accidental modification
  • Data Isolation: User data completely isolated from framework
  • Backup System: Automatic backups during migration

1.0.12 - 2025-07-28

Added

  • Enhanced multi-language support
  • Improved error handling in scripts
  • Better logging for debugging

Fixed

  • Path resolution issues on Windows
  • Unicode handling in notes
  • Installation script compatibility

1.0.11 - 2025-07-20

Added

  • Support for MT4 platform with --mt4 flag
  • Enhanced Thai language support
  • Better error messages

Changed

  • Improved idea generation prompts
  • Updated knowledge base

Fixed

  • Installation issues on macOS
  • Script execution permissions

1.0.10 - 2025-07-15

Added

  • Timeline-based note management system
  • Export functionality for notes
  • Markdown support in documentation

Changed

  • Reorganized command structure
  • Improved plan management workflow

Fixed

  • Template loading issues
  • Knowledge base search functionality

1.0.9 - 2025-07-10

Added

  • Initial public release
  • Core command system
  • Five trading personas
  • Basic EA generation
  • Multi-language support (TH/EN)

Known Issues in v1.0.x (Fixed in v1.1.0)

  • Framework files mixed with user data
  • Difficult to uninstall cleanly
  • Updates could overwrite user modifications
  • No clear separation of concerns

Upgrade Guide

From v1.0.x to v1.1.0

  1. Automatic Migration (Recommended):

    npm install -g @kwasati/strategylab@latest

    The installer will detect your existing installation and run migration automatically.

  2. Manual Migration:

    # Download v1.1.0
    npm install -g @kwasati/strategylab@1.1.0
    
    # Run migration tool
    python3 ~/.claude/StrategyLab/scripts/migrate_v1_1_0.py
  3. Verify Migration:

    # Check new structure
    ls ~/.claude/StrategyLab/     # Framework files
    ls ~/StrategyLab/             # Your data
    
    # Test commands
    sl help
    /strategylab

Rollback (if needed)

If you need to rollback:

# List backups
sl migrate --list-backups

# Restore from backup
sl migrate --restore [backup_path]

Support

For issues or questions: