nikkei225
High | Low | Open | Close | Volume | Adj Close | |
---|---|---|---|---|---|---|
Date | ||||||
2021-01-04 | 27602.109375 | 27042.320312 | 27575.570312 | 27258.380859 | 51500000 | 27258.380859 |
2021-01-05 | 27279.779297 | 27073.460938 | 27151.380859 | 27158.630859 | 55000000 | 27158.630859 |
2021-01-06 | 27196.400391 | 27002.179688 | 27102.849609 | 27055.939453 | 72700000 | 27055.939453 |
2021-01-07 | 27624.730469 | 27340.460938 | 27340.460938 | 27490.130859 | 98900000 | 27490.130859 |
2021-01-08 | 28139.029297 | 27667.750000 | 27720.140625 | 28139.029297 | 84900000 | 28139.029297 |
... | ... | ... | ... | ... | ... | ... |
2022-04-22 | 27205.830078 | 26904.380859 | 27197.800781 | 27105.259766 | 58500000 | 27105.259766 |
2022-04-25 | 26764.480469 | 26487.839844 | 26692.480469 | 26590.779297 | 62700000 | 26590.779297 |
2022-04-26 | 26808.990234 | 26592.990234 | 26743.210938 | 26700.109375 | 64300000 | 26700.109375 |
2022-04-27 | 26406.619141 | 26051.039062 | 26313.140625 | 26386.630859 | 97300000 | 26386.630859 |
2022-04-28 | 26876.949219 | 26348.359375 | 26430.279297 | 26847.900391 | 86700000 | 26847.900391 |
324 rows × 6 columns
import talib as ta
mom = ta.MOM(nikkei225.Close)
import plotly.graph_objects as go
from plotly.offline import iplot
plotly.offline.iplot(fig)
fig = go.Figure(go.Scatter(x=mom.index ,y=mom, name= 'Momentum',))
iplot(fig)
rsi9 = ta.RSI(nikkei225.Close, timeperiod=9)
rsi14 = ta.RSI(nikkei225.Close, timeperiod=14)
fig = go.Figure(go.Scatter(x=rsi9.index ,y=rsi9, name= 'RSI9',))
fig.add_trace(go.Scatter(x=rsi14.index ,y=rsi14, name= 'RSI14', ))
iplot(fig)
%K
, %D
Slow%D
(, Slow%K
)
からなります。%K
, %D
, Slow%D
を算出します。%K
, %D
は STOCHF
を、 Slow%D
は STOCH
を使います。fast_k, fast_d = ta.STOCHF(nikkei225.High, nikkei225.Low, nikkei225.Close, fastk_period=5, fastd_period=3)
slow_k, slow_d = ta.STOCH(nikkei225.High, nikkei225.Low, nikkei225.Close, fastk_period=5, slowk_period=3, slowd_period=3)
fig = go.Figure(go.Scatter(x=fast_k.index ,y=fast_k, name= '%K', ))
fig.add_trace(go.Scatter(x=fast_d.index ,y=fast_d, name= '%D', ))
fig.add_trace(go.Scatter(x=slow_d.index ,y=slow_d, name= 'Slow%D',))
iplot(fig)