# IF-THEN-ELSE

{% hint style="info" %}
**Hint**

The **IF-THEN-ELSE** module is used as an input data source for other modules.
{% endhint %}

{% hint style="info" %}
**Cascading**

The module **can be connected in a queue of conditions**. To do this, you need to select the input data source that **should send a signal for activation** (a value greater than <mark style="color:red;">**0**</mark>) and **enable cascading mode**.

<img src="https://content.gitbook.com/content/YAV7aJldax3OC32dTSHO/blobs/OGhc7AgTAQiFlUMV1RHC/BTCUSDT.PDEV_ENV%202024-01-20%2023-22-45.png" alt="" data-size="original">
{% endhint %}

The **IF-THEN-ELSE** module-indicator is your assistant that works on the principle of "**if, then, else**".

It allows you to set a condition (**IF**), for example, "*if RSI(14) is above 70*".

<figure><img src="https://content.gitbook.com/content/YAV7aJldax3OC32dTSHO/blobs/uu0lMAAUb65hwbD6WlKZ/BTCUSDT.PDEV_ENV%202024-01-20%2023-02-44.png" alt="" width="563"><figcaption></figcaption></figure>

The condition ([**RULE**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/condition-manager#id-1.-rule-pravila)) is set in the same way as in the [**CONDITION MANAGER**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/indicators/condition-manager) module.

If the condition is met, the module generates a signal for a specific action (**THEN**), say, sends a signal to buy a stock. If the condition is not met, the module generates a signal for a different action (**ELSE**), for example, to send a signal to sell the stock or simply wait.

It's like a smart autopilot for your trading strategy, which automatically responds to market changes according to the rules you set. You define the scenarios, and **IF-THEN-ELSE** follows your instructions, ensuring disciplined and consistent decision-making.

**IF-THEN-ELSE** not only sends a signal when a given condition is met but also allows you to configure different data sources for each possible outcome. Thus, you can obtain specific values from these sources that were relevant at the time the condition was triggered, giving you more information for making informed trading decisions.

<figure><img src="https://content.gitbook.com/content/YAV7aJldax3OC32dTSHO/blobs/ANOrcqUEYGbMPyWr7goh/BTCUSDT.PDEV_ENV%202024-01-23%2015-31-25.png" alt="" width="335"><figcaption></figcaption></figure>

The module has **four outputs**, which signal which condition was met, **THEN** or **ELSE**.

<figure><img src="https://content.gitbook.com/content/YAV7aJldax3OC32dTSHO/blobs/zZRKsypmxtPQ5mKLG0ar/BTCUSDT.PDEV_ENV%202024-01-23%2015-02-10.png" alt="" width="563"><figcaption></figcaption></figure>

The **IF-THEN-ELSE** module-indicator has the same [backtesting system](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/condition-manager#id-6.-backtesting-line) as the [**CONDITION MANAGER**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/indicators/condition-manager) module.
