# DATA SOURCE

{% hint style="success" %}
**Association**

**DATA SOURCE** is a constant.
{% endhint %}

The **DATA SOURCE** module is like a preparation table for a chef, where they can chop ingredients and mix them before cooking the dish. Here you can take data from other indicators, combine or modify them using mathematical operations, before using them in the main module [**CONDITION MANAGER**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/indicators/condition-manager) or any other module (even another **DATA SOURCE**) to create rules ([**RULE**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/condition-manager#id-1.-rule)) or constants ([**CONSTANT**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/condition-manager#id-4.-constants)). This versatile DATA SOURCE module can be used as a memory location or stack.

<figure><img src="https://754838710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYAV7aJldax3OC32dTSHO%2Fuploads%2FE6Xrhh2TKlSQU1jRp2iX%2Fimage.png?alt=media&#x26;token=0686ac4f-f5c7-4e71-83dc-91b12e46c4aa" alt="" width="525"><figcaption></figcaption></figure>

### CONSTANT mode is the main mode of module operation in which mathematical operations are performed on different data sources.

For example, if you need to check if the trading volume (*Volume*) is greater than the moving average (*MA*) value by 50% (*1.5 times*), you first use the **DATA SOURCE** module to calculate *1.5 \* MA(50)*. Then you use the resulting value in [**CONDITION MANAGER**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/indicators/condition-manager) as one of the external input data in **RULE** to compare with the trading volume. This helps you precisely adjust the conditions for your trading strategy.

{% hint style="danger" %}
**Attention**

You can read the order in which the calculations are made and a detailed description of the fields [**here**](https://docs.cdzv.com/code-zero-visual-trading_en/cdzv-toolkit/condition-manager#id-4.-constants).
{% endhint %}

<figure><img src="https://content.gitbook.com/content/YAV7aJldax3OC32dTSHO/blobs/tHMrnNvfmYkh9rHfX3p1/Image%202024-01-21%2018-49-26.png" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/YAV7aJldax3OC32dTSHO/blobs/sdJLqFmFvaJq9VblqWvP/BTCUSDT.PDEV_ENV%202024-01-20%2021-46-51.png" alt=""><figcaption></figcaption></figure>

### MEMORY mode is a mode of operation based on the principle of a memory cell into which a value can be written and read.

<figure><img src="https://754838710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYAV7aJldax3OC32dTSHO%2Fuploads%2Fn4oLYs8eF3fTjRXCFYbb%2Fimage.png?alt=media&#x26;token=f1ccafd1-c366-44db-86f8-496244062cf4" alt="" width="563"><figcaption></figcaption></figure>

**REMEBER SIGNAL** - Source that activates writing the value to the memory of the current **DATA SOURCE** calculation.

**CLEAR SIGNAL** - Source that activates clearing the value in memory and resetting it to 0.

### STACK mode is a queue where you can put values in and take them back out. It works in a “last put in” - “first take out” mode.

<figure><img src="https://754838710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYAV7aJldax3OC32dTSHO%2Fuploads%2FVQ4wa9O7po5imjjaOQGP%2Fimage.png?alt=media&#x26;token=fc92725c-dde5-4c9f-bb26-5c7e4ddf84d1" alt="" width="563"><figcaption></figcaption></figure>

**PUT SIGNAL** - Source that activates writing the current **DATA SOURCE** value calculation to the stack.

**GET SIGNAL** - A source that takes the last value from the stack, returns it to the output, and removes it from the stack.

**CLEAR SIGNAL** - A source that returns the last value from the stack and clears the entire stack.

**Send values until the next signal** - Return the last value from the stack on all bars until the next signal (true) or only on the bar where there was a signal (false)?

The **DATA SOURCE** module has **three outputs** that return the result of its operation for each of the modes of operation.

<figure><img src="https://754838710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYAV7aJldax3OC32dTSHO%2Fuploads%2FjjhvLmAs389dq9nwm4YG%2Fimage.png?alt=media&#x26;token=3f37d000-a192-4826-b94a-33916dec59fb" alt="" width="554"><figcaption></figcaption></figure>
