当前位置:网站首页>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 !
边栏推荐
- Androi weather
- [imx6ull] video monitoring project (USB camera +ffmepeg)
- Canvas random bubbling background
- Kotlin 协程的四种启动模式
- Win10 home vs pro vs enterprise vs enterprise LTSC
- Introduction to ROS from introduction to mastery (zero) tutorial
- 刘徽与《九章算术》《海岛算经》简介
- MySQL lpad() and rpad() concatenate string functions with specified length
- (01). Net Maui actual construction project
- Stack overflow learning summary
猜你喜欢

Opencv desaturation

Arduino control tm1637 common positive four digit nixie tube

MySQL lpad() and rpad() concatenate string functions with specified length
![[JS component] browse progress bar](/img/cb/913f446db2cacdb965a3bf619aa478.jpg)
[JS component] browse progress bar

Undirected graph -- computing the degree of a node in compressed storage

人神共愤,唐山“群殴女性事件”细节...

Can GPU acceleration pytorch work?

What is meebits? A brief explanation

(01).NET MAUI实战 建项目

AOF持久化
随机推荐
Androi天气
The scope builder coroutinescope, runblocking and supervisorscope of kotlin collaboration processes run synchronously. How can other collaboration processes not be suspended when the collaboration pro
Dynamic planning - good article link
Google play console crash information collection
What is dummy change?
Static analysis of malicious code
【北亚服务器数据恢复】虚拟机文件丢失导致Hyper-V服务瘫痪的数据恢复案例
Composite key relationships using Sqlalchemy - relationships on composite keys using Sqlalchemy
单片机串口中断以及消息收发处理——对接受信息进行判断实现控制
Set sail
Kotlin 协程的作用域构建器 coroutineScope与runBlocking 与supervisorScope,协程同步运行,协程挂掉的时候其他协程如何不被挂掉。
Three threads print digital demo alternately
Triangle wave and triangle wave convolution
Breadth first search for node editor runtime traversal
With a market value of more than trillion yuan and a sales volume of more than 100000 yuan for three consecutive months, will BYD become the strongest domestic brand?
Bubble sort - alternate sort at both ends
Go simple read database
MySQL queries the quantity of each month and the year-on-year and month on month data of each month
MySQL lpad() and rpad() concatenate string functions with specified length
[virtual machine] notes on virtual machine environment problems