首页 > 其他 > 详细

003其他指标

时间:2019-10-01 23:35:21      阅读:131      评论:0      收藏:0      [点我收藏+]

希尔伯特瞬时变换(HT_TRENDLINE):ta.HT_TRENDLINE(close)

Moving average with variable period(MAVP):ta.MAVP(close, periods, maxperiod=30, matype=0)

MidPoint over period(MIDPOINT):ta.MIDPOINT(close, timeperiod=14)

MidPoint Price over period(MIDPRICE):ta.MIDPRICE(high, low, acceleration=0, maximum=0)

抛物线指标(SAR):ta.SAR(high, low, acceleration=0, maximum=0)

抛物线扩展指标(SAREXT):ta.SAREXT(high, low)

技术分享图片
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import talib as ta
import tushare as ts

plt.rcParams[font.sans-serif] = [SimHei]
plt.rcParams[axes.unicode_minus] = False

df = ts.get_k_data(sh, start=2000-01-01)
df.index = pd.to_datetime(df.date)
df = df.sort_index()

df2 = pd.DataFrame(df.close)
df2[HT] = ta.HT_TRENDLINE(df.close)
periods = np.array([3]*len(df), dtype=float)
df2[MAVP] = ta.MAVP(df.close, periods)
df2[MIDPOINT] = ta.MIDPOINT(df.close)
df2[MIDPRICE] = ta.MIDPRICE(df.high, df.low)
df2[SAR] = ta.SAR(df.high, df.low)
df2[SAREXT] = ta.SAREXT(df.high, df.low)
df2.tail()

df2.loc[2018-01-01:2019-09-30,
        [close, HT, MAVP, MIDPOINT, MIDPRICE, SAR]
        ].plot(figsize=(16,6))
ax = plt.gca()
ax.spines[right].set_color(none)
ax.spines[top].set_colot(none)
plt.title(上证指数其他趋势指标, fontsize=15)
plt.xlabel(‘‘)
plt.show()
View Code

技术分享图片

 

技术分享图片
df2.loc[2018-01-01:2019-09-30, SAREXT].plot(figsize=(16,6))
ax = plt.gca()
ax.spines[right].set_color(none)
ax.spines[top].set_color(none)
plt.title(上证指数抛物线扩展走势, fontsize=15)
plt.xlabel(‘‘)
plt.show()
View Code

技术分享图片


 

003其他指标

原文:https://www.cnblogs.com/wintalau/p/11616316.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!