当前位置:网站首页>How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of BBI, MTM, obv, CCI and priceosc indicators
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of BBI, MTM, obv, CCI and priceosc indicators
2022-06-13 00:55:00 【Your name is Yu yuezheng】
Preface
From the stock market to the present , Many indicators have been developed , But when you use it, you will find , Due to the unknown fluctuation of the share price the next day , The indicators are not always accurate , There will always be miscalculations . For this inevitable situation , We can only try to quantify it 、 Calculate the yield after operation according to the strategy 、 Estimate the probability of misjudgment, etc
This article first selects BBI、MTM、OBV、CCI、PRICEOSC Five indicators to quantify ( A total of More than 30 indicators , Due to the space problem, five kinds of ), Then use ten stocks to test the effectiveness of these five strategies ( The actual situation is that 3600+ Stock to calculate the effect of strategy , It is not convenient to display the results at present )
disclaimer
Nothing in this vision and analysis should be interpreted as investment advice , Past performance does not necessarily indicate future results .
Quantitative analysis of index strategy
Data preparation
I chose 600519 Guizhou Moutai 、600031 Sany heavy industry 、002594 BYD 、601633 Great Wall motor 、002074 GuoXuan high tech 、300750 Ningde era 、300014 Yiwei lithium energy 、000591 The solar energy 、002475 State - precision 、600862 China Aviation hi tech These ten stocks 2020 year 1 month 1 Japan ~ 2021 year 1 month 15 Japan To test
Part of the code fragment
import pandas_datareader.data as web
import datetime
start = datetime.datetime(2020, 1, 1)
end = datetime.datetime(2021, 1, 15)
df = web.DataReader(ticker, "yahoo", start, end)
Index Introduction
sma It is the calculation function of smooth moving index
_ma Is a function of the moving average
_md Is a function of the standard deviation
_ema Is a function of the exponential moving average
BBI indicators
def bbi(df):
_bbi = pd.DataFrame()
_bbi['date'] = df['date']
_bbi['bbi_2'] = (_ma(df.close, 3) + _ma(df.close, 6) + _ma(df.close, 12) + _ma(df.close, 24)) / 4
return _bbi
MTM indicators
def mtm(df, n=6, m=5):
_mtm = pd.DataFrame()
_mtm['date'] = df.date
_mtm['mtm'] = df.close - df.close.shift(n)
_mtm['mtmma'] = _ma(_mtm.mtm, m)
return _mtm
OBV indicators
def obv(df):
_obv = pd.DataFrame()
_obv["date"] = df['date']
# tmp = np.true_divide(((df.close - df.low) - (df.high - df.close)), (df.high - df.low))
# _obv['obvv'] = tmp * df.volume
# _obv["obv"] = _obv.obvv.expanding(1).sum() / 100
_m = pd.DataFrame()
_m['date'] = df.date
_m['cs'] = df.close - df.close.shift()
_m['v'] = df.volume
_m['vv'] = _m.apply(lambda x: x.v if x.cs > 0 else (-x.v if x.cs < 0 else 0), axis=1)
_obv['obv'] = _m.vv.expanding(1).sum()
return _obv
CCI indicators
def cci(df, n=14):
_cci = pd.DataFrame()
_cci["date"] = df['date']
typ = (df.high + df.low + df.close) / 3
_cci['cci'] = ((typ - typ.rolling(n).mean()) /
(0.015 * typ.rolling(min_periods=1, center=False, window=n).apply(
lambda x: np.fabs(x - x.mean()).mean())))
return _cci
PRICEOSC indicators
def priceosc(df, n=12, m=26):
_c = pd.DataFrame()
_c['date'] = df['date']
man = _ma(df.close, n)
_c['osc'] = (man - _ma(df.close, m)) / man * 100
return _c
The final quantitative results
Due to the inconvenience of space and display , Do not show the visual buying and selling points and the fund change curve in the article
In order to understand the effect of the strategy most succinctly , The initial capital is set to 10000 element , And for the sake of simplicity, we don't consider the restriction that we must buy the whole hand , Every time 10000 Yuan to buy all , Test the effect of five index strategies at the same time 2020.1.1 Buy and hold until 2021.1.15 The strategy of , Compare the final funds to measure the effectiveness of the strategy
HOLD Line is a representation 2020.1.1 Buy and hold until 2021.1.15 The final fund of the strategy 
Data visualization is not shown here , After having data, you can draw and tabulate according to your habits ; More evaluation data are not shown
As a result, many strategies end up with lower returns than they have always held , But when the strategy does not hold shares, as a trader, of course, he will look for new opportunities , Generate revenue !
边栏推荐
- What is the difference between pytorch and tensorflow?
- Jenkins持续集成操作
- 牌好不好无法预料
- 市值破万亿,连续三个月销量破10万,比亚迪会成为最强国产品牌?
- Common skills of quantitative investment -- Drawing Part 1: Drawing stock closing price curve and ochl candle chart
- The grass is bearing seeds
- Win10 home vs pro vs enterprise vs enterprise LTSC
- 深度学习训练多少轮?迭代多少次?
- Three threads print digital demo alternately
- 什么是 Meebits?一个简短的解释
猜你喜欢
![[buglist] serial port programming does not read data](/img/bf/8e63f679bf139fbbf222878792ae21.jpg)
[buglist] serial port programming does not read data

Kotlin collaboration, the life cycle of a job

Can GPU acceleration pytorch work?

Expression tree - medium order printout

Druid reports an error connection holder is null

Learning and Development notes of mongdb
![[JS component] floating text](/img/e5/7faad5422bba919bed34e3dbcf7ba0.jpg)
[JS component] floating text

Et5.0 simply transform referencecollectorieditor

Arduino control soil moisture sensor

pytorch和tensorflow有什么区别?
随机推荐
Development notes of Mongoose
深度学习模型剪枝
(01).NET MAUI实战 建项目
How many steps are appropriate for each cycle of deep learning?
MySQL queries the quantity of each month and the year-on-year and month on month data of each month
Arduino controls tb6600 driver +42 stepper motor
高阶极点对于波形的影响
[North Asia server data recovery] data recovery case of Hyper-V service paralysis caused by virtual machine file loss
@Disallowcurrentexecution prevents quartz scheduled tasks from executing in parallel
Aunt learning code sequel: ability to sling a large number of programmers
Expression tree - medium order printout
Canvas random bubbling background
Kotlin 协程的作用域构建器 coroutineScope与runBlocking 与supervisorScope,协程同步运行,协程挂掉的时候其他协程如何不被挂掉。
sort
What is the difference between pytorch and tensorflow?
Bubble sort - alternate sort at both ends
Triangle wave and triangle wave convolution
Jenkins持续集成操作
Hard (magnetic) disk (II)
天津银行周传凯:从 0 到 1,我的分布式数据库落地经验谈