当前位置:网站首页>How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic benefits of ASI, VR, arbr, DPO and trix indicators
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic benefits of ASI, VR, arbr, DPO and trix 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 ASI、VR、ARBR、DPO、TRIX 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
ASI indicators
def asi(df, n=5):
_asi = pd.DataFrame()
_asi['date'] = df.date
_m = pd.DataFrame()
_m['a'] = (df.high - df.close.shift()).abs()
_m['b'] = (df.low - df.close.shift()).abs()
_m['c'] = (df.high - df.low.shift()).abs()
_m['d'] = (df.close.shift() - df.open.shift()).abs()
_m['r'] = _m.apply(lambda x: x.a + 0.5 * x.b + 0.25 * x.d if max(x.a, x.b, x.c) == x.a else (
x.b + 0.5 * x.a + 0.25 * x.d if max(x.a, x.b, x.c) == x.b else x.c + 0.25 * x.d
), axis=1)
_m['x'] = df.close - df.close.shift() + 0.5 * (df.close - df.open) + df.close.shift() - df.open.shift()
_m['k'] = np.maximum(_m.a, _m.b)
_asi['si'] = 16 * (_m.x / _m.r) * _m.k
_asi["asi"] = _ma(_asi.si, n)
return _asi
VR indicators
def vr(df, n=5):
_vr = pd.DataFrame()
_vr['date'] = df.date
_vr['vr_'] = df.volume / _ma(df.volume, n).shift(1)
_vr['rr_'] = (df.close - df.close.shift(1)) / df.close.shift(1) * 100
return _vr
ARBR indicators
def arbr(df, n=26):
_arbr = pd.DataFrame()
_arbr['date'] = df.date
_arbr['ar'] = (df.high - df.open).rolling(n).sum() / (df.open - df.low).rolling(n).sum() * 100
_arbr['br'] = (df.high - df.close.shift(1)).rolling(n).sum() / (df.close.shift() - df.low).rolling(n).sum() * 100
return _arbr
DPO indicators
def dpo(df, n=20, m=6):
_dpo = pd.DataFrame()
_dpo['date'] = df['date']
_dpo['dpo'] = df.close - _ma(df.close, int(n / 2 + 1))
_dpo['madpo'] = _ma(_dpo.dpo, m)
return _dpo
TRIX indicators
def trix(df, n=12, m=20):
_trix = pd.DataFrame()
_trix['date'] = df.date
tr = _ema(_ema(_ema(df.close, n), n), n)
_trix['trix'] = (tr - tr.shift()) / tr.shift() * 100
_trix['trma'] = _ma(_trix.trix, m)
return _trix
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
In the chart we notice
ARBR indicators Excellent performance , stay 600031、002564、000591 The performance of these stocks is better than the holding strategy , And the performance of the other seven stocks is not bad . But it is necessary to study this indicator in the whole A The performance of the stock market needs to consider thousands of stocks and data of more than ten years
Although in most cases, the effect of operating according to indicators is not as good as that of long-term holding strategy , But when the strategy does not hold shares, as a trader, of course, he will look for new opportunities , Generate revenue !
边栏推荐
- [JS component] browse progress bar
- Get preview of precast body
- Google play console crash information collection
- 今日在家休息
- AOF持久化
- pytorch是什么?解释pytorch的基本概念
- [buglist] serial port programming does not read data
- Arduino control tm1637 common positive four digit nixie tube
- Canvas game 2048 free map size
- The grass is bearing seeds
猜你喜欢

Arduino control soil moisture sensor

Kotlin coroutine withcontext switch thread

Assembly language learning

Triangle wave and triangle wave convolution

Cve-2021-24078 vulnerability analysis

MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)

Arduino controls tb6600 driver +42 stepper motor
![[JS component] customize the right-click menu](/img/a3/4555619db17e4c398e72c7d6b12f5d.jpg)
[JS component] customize the right-click menu

Et5.0 configuring Excel

MySQL exception: com mysql. jdbc. PacketTooBigException: Packet for query is too large(4223215 > 4194304)
随机推荐
[JS component] previous queue prompt
牌好不好无法预料
Tree - delete all leaf nodes
单片机串口中断以及消息收发处理——对接受信息进行判断实现控制
Three threads print digital demo alternately
Expression tree - medium order printout
kotlin 协程withContext切换线程
【服务器数据恢复】存储服务器之间迁移数据时数据丢失恢复成功案例
Unitywebrequest asynchronous Download
What is the difference between pytorch and tensorflow?
MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
Set sail
Android Weather
408 true question - division sequence
Jenkins持续集成操作
DNS attack surface analysis
@Disallowcurrentexecution prevents quartz scheduled tasks from executing in parallel
Programming training 1
[buglist] serial port programming does not read data
MCU serial port interrupt and message receiving and sending processing -- judge and control the received information