Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Technical Analysis Indicators

Hi Quantopian teams,

Does Quantopian also provide the Technical Analysis indicators such as Stochastic Oscillator, Ichimoku, or Bollinger Bands?

Thanks,
MMonocle

7 responses

You can import the talib library to use the indicators, here's an example showing the syntax: https://www.quantopian.com/help#sample-talib

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thank you.

Does Quantopian provide the Technical Analysis indicator: Ichimoku Cloud? Don't see it in talib.
Thanks

if daily data is enough for you, you can use the pipeline to get Ichimoku Cloud

tenkan_sen, kijun_sen, senkou_span_a, senkou_span_b, chikou_span = IchimokuKinkoHyo(inputs=[USEquityPricing.high, USEquityPricing.low, USEquityPricing.close], mask=my_universe)

pipe.add(tenkan_sen, "tenkan_sen")  
pipe.add(kijun_sen, "kijun_sen")  
pipe.add(senkou_span_a, "senkou_span_a")  
[...and so on...]

I would also like to use Ichimoku, I am new to algorithmic trading but usually trade manually.
I don't fully understand how to "use the pipeline to get Ichimoku Cloud"

Below is something that I have found but not sure how to use it, it might be different to what Luca means.

```import pandas as pd from pandas_datareader import data, wb

d=data.DataReader("F", 'yahoo', start, end)
high_prices = d['High']
close_prices = d['Close']
low_prices = d['Low']
dates = d.index
eighteen_period_high = pd.rolling_max(d['High'], window= 9 )
nine_period_low = pd.rolling_min(d['Low'], window= 9 )
d['tenkan_sen'] = (eighteen_period_high + eighteen_period_low) /2

Tenkan-sen (Conversion Line): (9-period high + 9-period low)/2))

period9_high = pd.rolling_max(high_prices, window=9)
period9_low = pd.rolling_min(low_prices, window=9)
tenkan_sen = (period9_high + period9_low) / 2

Kijun-sen (Base Line): (26-period high + 26-period low)/2))

period26_high = pd.rolling_max(high_prices, window=26)
period26_low = pd.rolling_min(low_prices, window=26)
kijun_sen = (period26_high + period26_low) / 2

Senkou Span A (Leading Span A): (Conversion Line + Base Line)/2))

senkou_span_a = ((tenkan_sen + kijun_sen) / 2).shift(52)

Senkou Span B (Leading Span B): (52-period high + 52-period low)/2))

period52_high = pd.rolling_max(high_prices, window=52)
period52_low = pd.rolling_min(low_prices, window=52)
senkou_span_b = ((period52_high + period52_low) / 2).shift(52)

The most current closing price plotted 22 time periods behind (optional)

chikou_span = close_prices.shift(-52) # 22 according to investopedia
```

I want to combine it with RSI, Volume, and trade according to specific situations where they are all aligned bullish or bearish.

I would also like to control the Ichimoku numbers 9,26, 52 and be able to change them according to my theory.
I have been learning on Quantopian for a few months now and playing around with algorithms but I would like to build something specifically to my requirements. I have been through all of Sentdex's tutorials etc too.

Thanks for Dhiren's code. I am new to algorithmic trading, too. It's a good practice for me to calculate the Ichimoku Cloud.

Hi Heyu,

It would also be useful to plot the Tenkam sen and Kijun sen and then be able to use these cross overs in trading.

I have tried to plot the following but it did not seem to work.
data['tenkan_sen'] = tenkan_sen
data['kijun_sen'] = kijun_sen