HaasScript Fundamentals

HaasScript Fundamentals

Learn the basics of developing, debugging, and deploying trade bots using HaasScript that have near limitless possibilities. This course is designed to help traders and developers get up to speed faster with HaasScript.

Getting Started

Explore Editor UI

Variables

In HaasScript, variables are used to store data and represent values that can change during the execution of your script. They allow you to store and manipulate data, such as numeric values, strings, and more complex data structures, such as tables or custom objects. Variables play a crucial role in creating trading algorithms, as they enable you to manage and process various types of information required for executing trades, making decisions, and analyzing market conditions.

Lessons

Using variables Immutable vs Mutable

Operators

Operators in HaasScript are symbols that perform specific operations on operands, such as variables or values. They allow you to carry out calculations, comparisons, and logical operations within your trading scripts. HaasScript operators are similar to those found in most programming languages, including arithmetic, comparison, and logical operators.

Lessons

Deeper dive into Relational Operators Operators and concatenating strings Deeper dive into Logical Operators

Strings

Strings are a data type that represents sequences of characters. They are used to store and manipulate text data, such as trading pair names, log messages, or any other textual information required in your trading algorithm. Strings in HaasScript are similar to those in many other programming languages.

Lessons

Built-in text-manipulation commands LUA's text-manipulation methods String.match (regex)

Built-in Functions

Managing Trades

Intervals

Intervals refer to the time periods used for gathering and analyzing market data, such as historical price data and technical indicators. Intervals play a crucial role in trading algorithms, as they determine the granularity of the data being analyzed and directly impact the bot’s decision-making process.

Lessons

Timing HaasScripts Intervals vs timers

Using Data

Debugging and Troubleshooting

Debugging and troubleshooting trading scripts is crucial for ensuring the reliability and effectiveness of your trading strategies. By identifying and resolving errors, inconsistencies, or unexpected behaviors in your code, you can improve the performance of your trading bot and reduce the risk of financial losses. Furthermore, regular debugging and troubleshooting enable you to fine-tune your strategies, optimize decision-making, and adapt to changing market conditions, ultimately leading to more consistent and profitable outcomes.

Lessons

Logging Testing for nil/empty

Converting Other Languages

HaasScript is a scripting language designed specifically for creating trading algorithms on HaasOnline platforms. While it shares similarities with Lua, it includes a range of custom functions and tools tailored for trading strategies. Converting existing code or logic from other programming languages to HaasScript is a common task for developers who want to leverage their existing strategies on the HaasOnline platform. This process involves understanding the differences and similarities between HaasScript and the source language, and then adapting the code accordingly.

Lessons

PineScript Python LUA

Other Best Practices

Developing, testing, and deploying trade bots requires careful planning and attention to detail to ensure successful implementation and reliable performance.

Lessons

Using source control Sharing on HaasScripts.com Writing PoC demos for shared HaasScripts

Pro Upgrade1. 3-Day Free Trial2. Unrestricted Access3.

Try HaasOnline Cloud Pro for 3-days and discover opportunities you've been missing.
Start 3-day free trial ›
1 TradeServer Cloud Pro offers a 3-day trial of our premium subscription.
2 During the 3-day TradeServer Cloud Pro trial you will not be required to pay to access Pro plan features. Subscription automatically renews unless auto-renewal is disabled or if you opt for manual payments.
3 Access to premium features within TradeServer Cloud does not include third-party restrictions or unforeseen issues.