The secret behind the chart | Trace back to the source of the K-line, variants of the K-line and data sources

We use the K line the most when trading, but have you ever thought about how the K line came from?

Will the exchange provide us with K-line data?

Let's first look at several types of K-lines. The K-lines we generally see are ordinary K-lines, similar to this:

The domestic habit is to use red for rising K-line and green for falling, because red symbolizes good luck in China. The foreign habit is to use green for rising K-line and red for falling, which is just the opposite of ours.

In addition to ordinary candlesticks, there are also some special or processed candlestick types, such as hollow candlesticks and average candlesticks:

Hollow K-line, its rising K-line cylinder is hollow, and the others are exactly the same as ordinary K-line. Including the opening price, closing price, high price, and low price are the same.

 

There is also a special K-line called the average K-line. Its calculation method is based on the ordinary K-line, but it is different from the ordinary K-line. The following is the average K-line chart of the same variety as above:

Comparing the previous picture, it can be found that the average K-line is smoother than the traditional K-line, and the trend can be clearly seen. This is due to the way it is calculated:

Opening price = (previous opening price + previous closing price/2;

Closing price = (current opening price + current closing price + current highest price + current lowest price/4;

high = max(high, open, close);

low = min(low, open, close);

The key advantage of the average candlestick chart is that it filters out bad signals (market noise), making it easier to capture good trading signals. 

Let's take the ordinary K-line as an example to see how it came about.

The data provided by domestic futures exchanges is called tick data . And our K line is synthesized from tick data. Generally speaking, when we trade manually on the software, we cannot see the tick data, but see the K-line data synthesized by the futures company or data provider:

Let's take a look at what the tick data looks like:

Tick ​​data contains more information than K-line data.

The tick data contains information on the market and the latest deal. The tick data of domestic futures, generally speaking, includes data such as the latest price, the selling price, the selling volume, the buying price, the buying volume, the daily trading volume, the trading volume, and the open interest. Some varieties provide five-level market data, that is, the market data from buy five to sell five. These varieties also include sell two to sell five, sell two to sell five, buy two to buy five, and buy two. To buy five quantities of data. Through these data, data such as the average price of the day, the highest price of the day, and the lowest price of the day can also be obtained. Some data providers also provide these data directly.

The K-line data is synthesized based on the above tick data. We can first extract the datetime data, classify it by minutes, and then get a collection of tick data per minute. Then according to the latest price last_price of these tick data, the first last_price of this minute is used as the opening price, the last last_price is used as the closing price, the maximum value of last_price is used as the highest price, and the minimum value of last_price is used as the minimum price, and a OHLC data for minute K-line. Is it very simple?

 

As for other time periods, such as 5-minute K-line, 15-minute K-line, 1-hour K-line, daily line, etc., they can be synthesized by 1-minute K-line.

In the next issue, we will talk about how to use Python to synthesize K-line by yourself, so stay tuned~

Guess you like

Origin blog.csdn.net/m0_62038975/article/details/123704911