We're excited to announce the launch of the HaasScript AI Reference, a comprehensive AI-optimized documentation resource designed specifically to help AI coding assistants like Claude, ChatGPT, Google Gemini, and GitHub Copilot provide accurate, high-quality support when you're writing HaasScript trading strategies.
The Challenge of AI-Assisted Trading Code
If you've ever tried asking ChatGPT, Claude, or Google Gemini to help you write a HaasScript trading strategy, you may have encountered a frustrating problem: the AI confidently generates code that looks reasonable at first glance, but contains subtle errors that can break your trading bot or worseâexecute trades incorrectly.
This happens because general-purpose AI models weren't trained on HaasScript's 600+ specialized trading commands. When asked to write HaasScript code, they often hallucinate function names, confuse syntax rules, or apply patterns from other programming languages that don't work in HaasScript's Lua-based environment.
The result? You spend more time debugging AI-generated code than you would have spent writing it yourself. Until now.
Introducing the HaasScript AI Reference
The HaasScript AI Reference is a specialized documentation repository structured specifically for machine consumption. Unlike traditional documentation written for humans, this resource is optimized to help AI assistants understand HaasScript's unique characteristics, common pitfalls, and best practices.
The documentation includes comprehensive coverage of all 600+ HaasScript commands, organized into specialized domains:
- Technical Analysis (157 commands) - Indicator calculations and signal generation
- Trading & Positions (139 commands) - Order management and position control
- Helpers (121 commands) - Utility functions for data manipulation
- Enumerations (197 values) - Constant definitions for exchange types, order types, and more
- Data & Prices (62 commands) - Market data access and price manipulation
- Advanced Features (97 commands) - Complex functionality for sophisticated strategies
How It Works
The AI Reference uses a two-tier documentation approach that mirrors how developers actually learn new frameworks:
1. Best Practices Guide (AGENT.md)
This file teaches AI assistants about HaasScript's unique characteristics and common mistakes to avoid. It covers critical details like:
- 1-based array indexing - Unlike most programming languages that start at 0, HaasScript arrays begin at index 1 (following Lua conventions)
- Log() vs print() - The difference between logging to the bot console versus debugging output
- Managed vs Unmanaged modes - How HaasScript handles automatic position management versus manual control
- Custom types - Understanding HaasNumberCollection, HaasSignal, and other specialized data structures
2. Domain-Specific References
Six specialized files provide detailed command references for each domain, including function signatures, parameter types, return values, and usage examples.
Real-World Benefits
The AI Reference dramatically improves the quality of AI-generated HaasScript code. Instead of hallucinating commands or applying incorrect syntax patterns, AI assistants can now:
- Generate syntactically correct code that compiles on the first try
- Use the right commands for technical analysis, position management, and data manipulation
- Avoid common pitfalls like off-by-one errors from 1-based indexing
- Apply HaasScript best practices for managed vs unmanaged trading modes
- Suggest appropriate indicators and explain their parameters correctly
Pre-Configured AI Assistants
To make getting started even easier, we've created pre-configured AI assistants that have already been trained on the HaasScript AI Reference:
- ChatGPT HaasScript Guru - A specialized GPT available in the ChatGPT store
- Google Gemini HaasScript Expert - A custom Gem optimized for HaasScript development
These assistants load the AI Reference automatically, so you can start asking questions and generating code immediately without any setup. Whether you prefer ChatGPT or Gemini, you'll get accurate, context-aware HaasScript code generation.
How to Use It
There are several ways to leverage the HaasScript AI Reference:
Option 1: Use Pre-Configured AI Assistants
The fastest way to get started is with our custom AI assistants for ChatGPT and Google Gemini. You'll find direct links to both assistants in the README.md file of the repositoryâjust click and start coding with AI that already has the full HaasScript reference loaded.
Option 2: Provide Context to Your AI Assistant
If you're using Claude, ChatGPT, Gemini, or another AI assistant through their standard interfaces, you can reference the documentation directly:
"I'm writing HaasScript code for cryptocurrency trading. Please refer to the HaasScript AI Reference at https://github.com/Haasonline/haasscript-ai-reference before generating code. I need help creating a strategy that..."
Option 3: Clone and Customize
Advanced users can clone the GitHub repository and customize the documentation for their specific use cases or integrate it into their development workflows.
Example Use Case
Let's say you want to create a simple momentum trading strategy using RSI and moving averages. Instead of getting generic (and potentially incorrect) code, you can now ask:
"Using HaasScript, create a managed trading strategy that:
- Calculates RSI with a 14-period lookback
- Uses a 20-period simple moving average
- Goes long when RSI crosses above 30 and price is above the SMA
- Exits when RSI crosses above 70"
With the AI Reference, your AI assistant will generate code using the correct HaasScript commands (like RSI() and SMA()), proper 1-based array indexing, appropriate managed trading mode functions, and proper signal handlingâall without hallucinating non-existent commands or syntax.
The Future of AI-Assisted Trading Development
The HaasScript AI Reference represents our commitment to making automated trading development more accessible. Whether you're a seasoned algorithmic trader or just getting started with trading automation, AI-assisted development can significantly accelerate your workflowâas long as the AI has accurate information to work with.
We'll continue expanding and refining the AI Reference as HaasScript evolves, ensuring that AI assistants always have access to the latest commands, best practices, and usage patterns.
Get Started Today
Ready to experience the difference AI-optimized documentation makes? Visit the HaasScript AI Reference on GitHub to explore the documentation, or jump straight into using one of our pre-configured AI assistants.
We're excited to see what trading strategies you'll build with the power of AI-assisted development at your fingertips.
Get started with automated crypto trading and put your AI-generated HaasScripts to work.
â the HaasOnline Team