Welcome to subscribe to the Python Data Analysis Practical: Building a Quantitative Trading System for Stocks booklet. After you finish this booklet, be sure to use your knowledge to help us analyze stocks!

preface

Believe everybody heard quantitative trade this thing!

Quantitative trading is an emerging systematic financial investment method. It integrates the knowledge of multiple disciplines, uses advanced mathematical models to replace human subjective thinking to formulate trading strategies, and uses the powerful computing power of computers to backtest the profit and loss “probability” of trading strategies from huge historical data such as stocks, bonds and futures. Helps investors make accurate decisions by managing the “probability” of profit and loss.

So, what is the suitable way for ordinary shareholders to open quantitative trading?

This article with a ground gas of the stock analysis scenario – with the quantitative method to identify the extreme value of the stock price band to share with you, how ordinary shareholders to use quantitative trading!

Identify the band extremum

Stocks do not move in a single straight line, but like the waves of the sea, there are high and low. So the ups and downs of stock prices will form a wave band.

Many classic strategies are based on band analysis. Elliott’s wave theory, buying low and selling high, looking for support and pressure levels, etc.

The common basis of all these strategies, however, is the identification of bands, or extreme points in share prices.

Usually we are with the naked eye in the market software to identify and mark, then the so-called quantization is the extreme value of the characteristics of the point into an algorithm model, with quantization program to identify.

The first step is to identify the golden fork and the dead fork. (On the realization of the principle in the past “small scattered quantitative stock” has been introduced, here is not repeated)

Here we first identify the gold and dead MACD forks. As you can see, the tag G is gold fork (GLOD abbreviation) and the tag D is DEATH fork (DEATH abbreviation).

The second step is to find the extremum based on the golden fork and the dead fork. The principle is simple: there must be a maximum between a golden fork and a dead fork, just as there must be a minimum between a dead fork and a golden fork. As follows:

To find the maximum value, the key code looks like this:

Df_temp_1 = dF_StockLoad [(df_stockLoad.index <= dF_stockLoad.index [I])] dF_temp_2 = df_stockLoad [(df_stockLoad.index <= df_stockLoad.index [I])] df_temp_2 = df_stockload[(df_StockLoad df_temp_1[df_temp_1.cross_m > 0] if df_temp_2.empty == False: df_temp_3 = df_temp_1[(df_temp_1.index >= df_temp_2.index[-1])] close_val = df_temp_3["High"].max() # df_temp_4 = df_temp_3[df_temp_3["High"].values == df_temp_3["High"].max()] time1 = df_temp_4.index.to_pydatetime()[0].strftime("%Y-%m-%d") posit = df_stockload.index.get_loc(time1) df_stockload.loc[df_temp_4.index, "Max"] = TrueCopy the code

Matplotlib library annotate method annotate annotate method

Now, what’s the benefit of marking the maximum and minimum frequencies?

Firstly, the pressure level corresponding to the maximum value of the band and the support level corresponding to the minimum value of the band are obtained. This value can be referred to the corresponding trading volume of the day.

And the volume of the pressure level over a period of time can be added up as resistance to the current breakout.

Secondly, we can connect the maximum and minimum values of the bands respectively to judge the trend. As shown in the figure below:

For example, if we recognize that the high and low of a continuous band are both near the same value, we can tell that we are currently in a volatile trend. When successive band highs and lows continue to rise, then the current is in an uptrend, the same as the judgment of a downtrend. This is the overall direction of the grasp.

conclusion

Through this simple and practical stock quantitative scenario, I hope to give the majority of friends for quantitative trading have an intuitive feeling.

Then, we should upgrade their own way to fry, the stock before their own that set of methods, abstract into a strategic model, with quantitative methods to the whole market back test evaluation, and then let the program to help us monitor the trend of the market.

This is the quantitative trade that ordinary shareholder place suits opens way!

— — — — — — — — — — — — — — — — — — — — — — — —If you want to have a more comprehensive and systematic introduction to the knowledge points involved from 0-1 way, here I recommend my book to youQuant Trading in Python Stocks from Beginning to Practice! Tmall, JINGdong, dangdang fully open for sale!

At the same time, you are welcome to follow my wechat official account [Yuanxiao Master Takes you to quantitative Trading in Python] to learn more about quantitative trading in Python

Routines in the code, uploaded to “play with the stock quantitative trading” knowledge planet (knowledge planet catalog can click [read] view).