# How to modify the indicator to work with CDZV Toolkit

{% hint style="info" %}
For modification the indicator must be written in pine-script version 5

//@version=5
{% endhint %}

To integrate with CDZV Toolkit, you can use TradingView indicators that display information using the [**plot**](https://www.tradingview.com/pine-script-reference/v5/#fun_plot) function.

All other indicators that are open source can be easily **modified**.

**CDZV Toolkit** processes two types of input information from indicators:

1. *Numeric values* (price, volume and any other **floating point numeric value**).
2. *Signal* (this is also a numeric value, but it is limited: **0 - no signal** or **1 - signal is present**).

These values can be sent from the indicator using the *PineScript* **plot()** function with the parameter **display = display.data\_window**. This parameter indicates that we do not draw anything on the plot, but will be available to the **CDZV Toolkit**.

***Examples**:*

1️⃣ The indicator draws BUY/SELL labels on the chart or sends alerts. We need to pass them to Condition Manager as signals. <https://www.tradingview.com/script/lSHzm9zV-CM-I-RideTheWave7/>

```
// Here the original indicator draws the inscriptions
plotshape(buySignalk[1] and showsignalsk and O1[1] > K2 ? AlphaTrend[2] * 0.9999 : na, title='LONG', text='LONG', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(#0022FC, 0), textcolor=color.new(color.white, 0))
plotshape(sellSignalk[1] and showsignalsk and O2[1] > K1 ? AlphaTrend[2] * 1.0001 : na, title='SHORT', text='SHORT', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.maroon, 0), textcolor=color.new(color.white, 0))

// Here the original indicator sends alerts
alertcondition(buySignalk[1] and O1[1] > K2, title='Confirmed BUY Alarm', message='BUY SIGNAL APPROVED!')
alertcondition(sellSignalk[1] and O2[1] > K1, title='Confirmed SELL Alarm', message='SELL SIGNAL APPROVED!')
```

Make modifications to the indicator code:

```
// We add code to send signals to the CDZV Toolkit
// We define the logic for drawing and sending signals
// and create a plot() object that sends a 0 or 1 signal.
plot(buySignalk[1] and O1[1] > K2 ? 1 : 0, "SIGNAL: BUY", display = display.data_window)
plot(sellSignalk[1] and O2[1] > K1 ? 1 : 0, "SIGNAL: SELL", display = display.data_window)
```

Result:

<figure><img src="/files/sqN0xU0TaUMm1uPjh2GU" alt=""><figcaption></figcaption></figure>

2️⃣ The indicator draws fractals/pivots on the chart. It is necessary to transfer their price to **CDZV Toolkit**. <https://www.tradingview.com/script/1yk1pUCb-CM-I-Williams-Fractals/>

```
// The indicator draws fractals from above and below with offset=-n
plotshape(downFractal, style=shape.triangledown, location=location.belowbar, offset=-n, color=#F44336, size = size.small)
plotshape(upFractal, style=shape.triangleup, location=location.abovebar, offset=-n, color=#009688, size = size.small)
```

add the code that passes the price to **CDZV Toolkit**:

<figure><img src="/files/hLq62jZiN3GRYCrTr7ui" alt=""><figcaption></figcaption></figure>

```
// get the Low and High price if a fractal was found earlier
if upFractal
    last_up_price := high[n]

if downFractal
    last_down_price := low[n]

// We add code to send fractal prices to CDZV Toolkit
// create a plot() object that sends a price (a number with a plaвающей запятой)
plot(last_up_price, title = 'UP Price', display = display.data_window)
plot(last_down_price, title = 'DOWN Price', display =display.data_window)
```

Result:

<figure><img src="/files/Hn6nZQTFJTET1LvkoCVw" alt=""><figcaption></figcaption></figure>

3️⃣ The indicator draws an oscillator that changes its color and it is necessary to transmit signals when the oscillator is **GREEN** or **RED**. <https://www.tradingview.com/script/JUK476pQ-CM-I-Schaff-Trend-Cycle-STC/>

```
// Find the code responsible for the oscillator color
mSTC = STC(defLen, fastLen, slowLen)
mColor = mSTC > mSTC[1] ? color.new(color.green, 20) : color.new(color.red, 20)

plot(mSTC, color=mColor, title='STC', linewidth=2)
```

and below that add logic that will send a **GREEN**/**RED** signal

```
plot(mSTC > mSTC[1] ? 1 : 0, 'SIGNAL: GREEN', display = display.data_window)
plot(mSTC <= mSTC[1] ? 1 : 0, 'SIGNAL: RED', display = display.data_window)
```

Result:

<figure><img src="/files/OmWPLah62NSCIermC7t5" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cdzv.com/code-zero-visual-trading_en/user-guide/how-to-modify-the-indicator-to-work-with-cdzv-toolkit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
