Variables Test Block — This block is a conditional block that tests the value of Kryll variables and triggers an action when the condition is true.
A test in computing is an operation that compares two values and returns a Boolean result: true or false. In the context of a trading bot, a test can be used to compare data stored in your variables with market data. This allows, for example, comparing the current price of an asset with the one you recorded during the previous trade, comparing the value of a counter with a specific value to create a 'for' loop, or even comparing the number of your winning and losing trades to adjust your money management.
The Kryll ecosystem is designed to give you maximum freedom in creating your own trading bots. In this perspective, the 'Variable Test' block has been developed to be an essential tool in your bots. It offers the possibility to compare various variables, thus refining the precision and efficiency of your trading strategy, and guiding its logic based on your own criteria.
To use this block, start by dragging and dropping it into your strategy. Then select the variables (which can be system or custom variables) and the test you want to perform.
Select here the first element of your comparison (Operand). This value can be chosen from the available options:
- The current price
- A free numeric value
- The current RoE of the strategy
- The current RoE excluding the savings set aside by the "Piggy" block
- A variable that you have defined in your strategy, which you can select through a drop-down list
- The price of the last transaction
Select a comparison operator among equal, greater than, greater than or equal to, less than, less than or equal to.
Select your second Operand (the first element of your comparison) from the proposed options: the current price, a free numeric value, the current RoE of the strategy, the current RoE of the strategy without taking into account the savings set aside by the "Piggy" block, a variable, or the price of the last transaction.
The block will trigger when the result of the test performed between your two operands is true.
With the Variable Test block, you can perform tests to direct the logic of your strategy without going through personal variables. For example, you can use this block to test if the current price of an asset has increased or decreased compared to the price of the last transaction made as can be seen in this example.
When developing your trading strategy, it can be extremely useful to take a look under the hood to understand how variables interact. Thanks to the developer mode of the Info block, you can do this easily.
By checking the option "display to developer only", the block gives you the possibility to consult the list of custom variables that your strategy has used so far, as well as their current value. To access this feature, simply activate the "List used variables" option. This will provide you with valuable insights into the variables at play, helping you further refine your strategy.
Did you know?
It's possible to go even further by combining the Variable Test block and Variable Operation block, thus implementing a multitude of actions in your bot. Discover how to optimize your strategy by setting up for loops, calculating the ratio of your bot's winning trades, or even adapting your risk exposure based on the return on investment of your strategy. Everything is covered in this article dedicated to Kryll variables.
Telegram EN: https://t.me/kryll_io
Telegram FR: https://t.me/kryll_fr
Telegram ES: https://t.me/kryll_es