📰 Latest: HaasOnline Academy Is Back — Structured Education for Smarter Trade Bots
Account
Glossary

Custom Command

A unique feature of HaasOnline's HaasScript are custom commands — essentially reusable functions that can be included within any script or command, which saves time and keeps your code organized. You can save or create a custom command by selecting "Custom Command" from the dropdown while creating a new script in the web editor. Once created, a custom command can be called from any other script, allowing you to build modular, maintainable trading logic without duplicating code.

Custom commands are particularly useful for encapsulating complex logic that you use repeatedly across multiple bots or strategies. For example, you might write a custom command to calculate a specific indicator combination, manage position sizing, or handle a particular entry or exit condition. By defining this logic once in a custom command, you ensure consistency across all your scripts and make future updates easier — change the command once, and every script using it benefits immediately.

For advanced HaasScript users, custom commands are a key tool for building sophisticated, scalable trading systems. They encourage a programming mindset where common logic is abstracted and reused rather than copied, reducing bugs and improving readability. Whether you are a beginner looking to simplify your scripts or an experienced developer building a library of trading utilities, custom commands make HaasScript a more powerful and efficient environment.