Skip to content
All library documents

Visualizing Volatility and Trend Indicators with Technical Analysis Features

Notebook Technical Analysis

Summary

This notebook demonstrates how to load price and volume data, add a broad set of technical analysis features with a Python library, and plot selected indicators alongside market prices. Its volatility examples include Bollinger Bands, Keltner Channels, and Donchian Channels; its trend examples include MACD, KST, and Ichimoku lines. It also loops through the resulting columns to display each feature individually.

The evidence consists of plotted examples from slices of the supplied dataset, rather than a trading strategy evaluation. The notebook shows how these features look in historical data and can support exploratory analysis, but it does not explain indicator formulas in depth, define entry or exit rules, or measure predictive power. It also gives no details about the dataset’s market, sampling frequency, or date range, so the plots alone cannot establish that an indicator is useful across instruments or regimes.

Key ideas

  • A technical analysis library can add many volatility and trend features to price and volume data.
  • Bollinger Bands, Keltner Channels, and Donchian Channels are plotted against closing prices.
  • MACD, KST, and Ichimoku components are examples of trend features shown in the notebook.
  • The plots are exploratory illustrations and do not test trading rules or predictive performance.
  • The dataset’s market and sampling details are not specified.

Tags

Full text
# Ploting different new features


# Ploting different new features

```python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('seaborn')

import ta
```

```python
# Load data
df = pd.read_csv('../test/data/datas.csv', sep=',')
df = ta.utils.dropna(df)
```

```python
df.shape
```

```python
df.head()
```

```python
# Add all ta features filling nans values
df = ta.add_all_ta_features(df, "Open", "High", "Low", "Close", "Volume_BTC", fillna=True)
```

```python
df.shape
```

# Ploting some volatility features

### Bollinger Bands

```python
plt.plot(df[40500:41000].Close)
plt.plot(df[40700:41000].volatility_bbh, label='High BB')
plt.plot(df[40700:41000].volatility_bbl, label='Low BB')
plt.plot(df[40700:41000].volatility_bbm, label='EMA BB')
plt.title('Bollinger Bands')
plt.legend()
plt.show()
```

### Keltner Channel

```python
plt.plot(df[40500: 41000].Close)
plt.plot(df[40500: 41000].volatility_kcc, label='Central KC')
plt.plot(df[40500: 41000].volatility_kch, label='High KC')
plt.plot(df[40500: 41000].volatility_kcl, label='Low KC')
plt.title('Keltner Channel')
plt.legend()
plt.show()
```

### Donchian Channel

```python
plt.plot(df[40500: 41000].Close)
plt.plot(df[40500: 41000].volatility_dch, label='High DC')
plt.plot(df[40500: 41000].volatility_dcl, label='Low DC')
plt.title('Donchian Channel')
plt.legend()
plt.show()
```

# Ploting trend features

### MACD

```python
plt.plot(df[40500:41000].trend_macd, label='MACD')
plt.plot(df[40500:41000].trend_macd_signal, label='MACD Signal')
plt.plot(df[40500:41000].trend_macd_diff, label='MACD Difference')
plt.title('MACD, MACD Signal and MACD Difference')
plt.legend()
plt.show()
```

### KST

```python
plt.plot(df[40700:41000].trend_kst, label='KST')
plt.plot(df[40700:41000].trend_kst_sig, label='KST Signal')
plt.plot(df[40700:41000].trend_kst_diff, label='KST - KST Signal')
plt.title('Know Sure Thing (KST)')
plt.legend()
plt.show()
```

### Ichimoku Kinkō Hyō

```python
plt.plot(df[40500:41000].Close)
plt.plot(df[40500:41000].trend_ichimoku_a, label='Ichimoku a')
plt.plot(df[40500:41000].trend_ichimoku_b, label='Ichimoku b')
plt.title('Ichimoku Kinko Hyo')
plt.legend()
plt.show()
```

# Ploting all features

```python
for col in df.columns:
    plt.plot(df[col])
    plt.title(col)
    plt.show()
```

```python

```

```python

```

```python

```

```python

```

```python

```

```python

```

```python

```

```python

```
![notebook output](figures/p1_1.png)
![notebook output](figures/p1_2.png)
![notebook output](figures/p1_3.png)
![notebook output](figures/p1_4.png)
![notebook output](figures/p1_5.png)
![notebook output](figures/p1_6.png)
![notebook output](figures/p1_7.png)
![notebook output](figures/p1_8.png)
![notebook output](figures/p1_9.png)
![notebook output](figures/p1_10.png)
![notebook output](figures/p1_11.png)
![notebook output](figures/p1_12.png)
![notebook output](figures/p1_13.png)
![notebook output](figures/p1_14.png)
![notebook output](figures/p1_15.png)
![notebook output](figures/p1_16.png)
![notebook output](figures/p1_17.png)
![notebook output](figures/p1_18.png)
![notebook output](figures/p1_19.png)
![notebook output](figures/p1_20.png)
![notebook output](figures/p1_21.png)
![notebook output](figures/p1_22.png)
![notebook output](figures/p1_23.png)
![notebook output](figures/p1_24.png)
![notebook output](figures/p1_25.png)
![notebook output](figures/p1_26.png)
![notebook output](figures/p1_27.png)
![notebook output](figures/p1_28.png)
![notebook output](figures/p1_29.png)
![notebook output](figures/p1_30.png)
![notebook output](figures/p1_31.png)
![notebook output](figures/p1_32.png)
![notebook output](figures/p1_33.png)
![notebook output](figures/p1_34.png)
![notebook output](figures/p1_35.png)
![notebook output](figures/p1_36.png)
![notebook output](figures/p1_37.png)
![notebook output](figures/p1_38.png)
![notebook output](figures/p1_39.png)
![notebook output](figures/p1_40.png)
![notebook output](figures/p1_41.png)
![notebook output](figures/p1_42.png)
![notebook output](figures/p1_43.png)
![notebook output](figures/p1_44.png)
![notebook output](figures/p1_45.png)
![notebook output](figures/p1_46.png)
![notebook output](figures/p1_47.png)
![notebook output](figures/p1_48.png)
![notebook output](figures/p1_49.png)
![notebook output](figures/p1_50.png)
![notebook output](figures/p1_51.png)
![notebook output](figures/p1_52.png)
![notebook output](figures/p1_53.png)
![notebook output](figures/p1_54.png)
![notebook output](figures/p1_55.png)
![notebook output](figures/p1_56.png)
![notebook output](figures/p1_57.png)
![notebook output](figures/p1_58.png)
![notebook output](figures/p1_59.png)
![notebook output](figures/p1_60.png)
![notebook output](figures/p1_61.png)
![notebook output](figures/p1_62.png)
![notebook output](figures/p1_63.png)
![notebook output](figures/p1_64.png)
![notebook output](figures/p1_65.png)
![notebook output](figures/p1_66.png)
![notebook output](figures/p1_67.png)
![notebook output](figures/p1_68.png)
![notebook output](figures/p1_69.png)
![notebook output](figures/p1_70.png)
![notebook output](figures/p1_71.png)
![notebook output](figures/p1_72.png)
![notebook output](figures/p1_73.png)
![notebook output](figures/p1_74.png)
![notebook output](figures/p1_75.png)

Shown in full with attribution under the source's licence. Licence: MIT

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.