Timing HaasScripts

By default, every script in HaasScript is run based on 1 minute ticks. This means that any code you write will be executed every minute. However, it is possible to make your script run faster than this by using the EnableHighSpeedUpdates() command.

The EnableHighSpeedUpdates() command allows your script to run every 15 seconds (Cloud) or 5 seconds (Enterprise), instead of every minute. This can be useful if you need to execute code more frequently, such as when you are monitoring the market for changes.

Here’s an example of how to use the EnableHighSpeedUpdates() command:

-- Enable high speed updates
EnableHighSpeedUpdates()

-- Print the current close price
Log( CurrentPrice().close )

In this example, the EnableHighSpeedUpdates() command enables high speed updates, which allows the script to print current close price more often.

It’s important to note that enabling high speed updates can put additional strain on your system’s resources, so it’s important to use it judiciously and only when it is necessary. Additionally, certain exchanges may have rate limits or other restrictions that limit how often you can make requests to their APIs, so be sure you are not constantly placing and cancelling orders.

Back to: HaasScript Fundamentals > Intervals