Description: Profit ratio
Category: indicators
Parameter: A is an array (variable) or a constant.
Return: Returns an array.
Note: Calculate the profit-taking ratio. This function is only valid for the daily analysis cycle.
Example: WINNER(CLOSE), which indicates the proportion of profitable discs sold at the current closing price; For example, returning 0.2 represents a 20% profit disk;
The winner (10) represents the profit-taking ratio of 10 yuan.
Winner and cost are just opposite functions. The former obtains the profit ratio from the price, while the latter obtains the price from the profit ratio. Using these two functions flexibly, the cost can be quantitatively analyzed and calculated.
Cost, cost. Winner, winner, profit.
The two are mutually transformed. COST estimates the price according to the profit-making disk, and WINNER estimates the profit-making disk according to the price.
The reason for the estimation is that in order to calculate accurately, it is necessary to record the price and volume of each transaction, which is generally difficult to do.
Even if it can be done, is the technical analysis of chip distribution effective? It depends on everyone's own choice. At present, there are no technical indicators in the stock market.
Cost (winner (c) *100);
c;
The two tend to be equal. It also shows that these two functions support sequence variables.
Calculation of average cost price. Multiply each transaction volume that has just completely changed hands by the transaction price, and then divide it by the total transaction volume during this period, which is the average cost price.
Average cost price: cost (50);
AA:=SUMBARS(VOL,CAPITAL);
Average cost price: SUM(C*V, AA)/SUM(V, aa);
In fact, these two methods are both estimates, and the error of the latter may be greater.
It is equivalent to 2 yuan a catty of apples and 5 yuan a catty of apples. The average price of three boxes of apples is (2* 1+5*2)/( 1+2)=4 yuan.
This is a bit like the harmonic average in statistics. To complicate the distribution of the chip, we can calculate the median and multiple values, study the normal distribution and skewed distribution, as well as the concentration and permeability, which is really varied.
In which price region is the peak of chip distribution, which is an index that chip distribution enthusiasts want to know. It can be estimated by cost.
Principle of cost allocation:
Investors are usually interested in the average cost of stocks. Both MA and e MA are algorithms to calculate the average cost of stocks, but these algorithms do not consider the influence of trading volume on the average cost. For example, suppose a stock fluctuates between 10-20 yuan recently, and its average price MA is 15 yuan, but observing its trading volume, it is found that the trading volume near 20 yuan is huge. However, the trading volume is scarce near 10 yuan, so we think that the average cost should obviously be higher than 15 yuan, so we can introduce the concept of moving average of turnover rate; Taking the turnover rate of the day as a smoothing factor, calculate the index smma, and the formula is as follows:
Y:=( 1-A)*Y'+A*C
A stands for turnover rate, C stands for closing price, and Y and Y' stand for today's average price and yesterday's average price respectively.
The calculation method of the weighted average is: Zax, where x is the numerical value to be counted and a is the proportion of x to the total. The average cost y of a day can be expressed in two parts. The cost of buying that day is the closing price c, the cost of buying before is y', and the ratio of buying that day is the turnover rate a, and the ratio of buying before is 1-A, so today's weighted average cost is (.
But there are still two problems to be solved. One is that the closing price can't truly represent the cost of the day, and the other is that we can't know the distribution of the whole cost, that is, we only know the average cost and don't know the distribution of the whole position, which is sometimes very useful. For example, the total cost of holding a stock is 10 yuan, while 5 yuan buys 50% of the other stock and 15 yuan buys 50%. The average price of these two stocks is 10 yuan, but their performances are bound to be very different.
Mobile cost allocation
Mobile cost allocation is put forward to solve the above problems. It extends the concept of average cost from an average line to a distribution chart, showing the cost distribution of all current positions. Equal-spaced horizontal lines indicate distribution, vertical position of horizontal lines indicates cost price, and length indicates relative proportion. The longest line occupies the display area, and the remaining lines are displayed at the same scale.
The algorithm of cost allocation is the same as the basic principle of calculating exponential smooth moving average with turnover rate as smoothing factor. The main difference is that it calculates not one but a set of values, that is, the cost of the day is not the closing price, but a set of data from the lowest price to the highest price.
The cost allocation algorithm is calculated based on the following assumptions:
A) The daily cost is evenly distributed between the lowest price and the highest price, and the moving cost chart is a rectangle from the lowest price to the highest price, which we call daily cost;
B) Every day's transaction happens with equal probability, that is, regardless of the buying opportunity, the probability of the stock holder being thrown out on the same day is the same, whether it is locked up or profitable.
Cost allocation chart:
A) The cost distribution chart of listing every day is the cost of that day, that is, a rectangle between the lowest price and the highest price.
B) The cost distribution of each day thereafter satisfies Y =( 1-A)* Y'+A * B, where a represents the turnover of the day, b represents the cost of the day, and y and Y' represent the cost distribution of the day and the day before. Note that b, y and y' here all represent a distribution, not a numerical value.