Nighshark | Reading Areas functionality
Introduction
Youtube Tutorial:
NightShark is a desktop application designed for algo-trading through UI automation. One of its standout features is the read_areas()
function, which allows traders to monitor real-time metrics on their desktop trading platforms. In this blog post, we'll delve into how this function works and why it's essential for anyone looking to automate their trading strategies.
What is read_areas()
?
The read_areas()
function is a pre-built feature in NightShark that enables the application to read specific areas on the screen. These areas are defined by the user using NightShark's "Add areas" button, which activates a snipping tool. Once you've drawn around the metrics or signals you want to track, NightShark will continuously monitor these areas for changes.
Why is read_areas()
Important?
In the fast-paced world of trading, every second counts. Real-time metrics like stock prices, trading volumes, and other indicators can change in the blink of an eye. The read_areas()
function allows you to keep track of these metrics in real-time, providing the data you need to make informed trading decisions instantly.
How Does It Work?
The read_areas()
function is typically implemented within a loop to ensure continuous monitoring. Here's a simplified example:
loop {
read_areas()
if (toNumber(area[1]) > 20) {
Click(point.a) // Executes a Buy order
} else if (toNumber(area[1]) < -10) {
Click(point.b) // Executes a Sell order
}
Sleep 1000 // Pauses for 1 second before the next iteration
}
In this example, NightShark continuously reads the area defined for a specific metric (let's say stock price). If the stock price goes above 20, it executes a Buy order by clicking a predefined point on the screen (point.a
). If it falls below -10, it executes a Sell order by clicking another point (point.b
).
Conclusion
The read_areas()
function in NightShark is a game-changer for algo-traders. By allowing users to monitor real-time metrics continuously, it provides a powerful tool for automating trading strategies. With read_areas()
, you're not just keeping up with the market; you're staying ahead of it.
Happy trading!