Current location - Trademark Inquiry Complete Network - Futures platform - Stock formula editing
Stock formula editing

There is a lot of basic knowledge that needs to be analyzed one by one. Please refer to it below!

Lecture 1: Understanding the formula editor

The formula editor is a window for importing source code and writing indicators. There are four types of formula editors, namely:

1. Technical indicator formula editor;

2. Conditional stock selection formula editor;

3. Trading system formula editor;

4. Colorful K-line formula editor.

Because the expansion and use of these editors are similar. Therefore, this article only takes the technical indicator formula editor as an example to illustrate.

Due to the current differences in various stock software, not only are some functions not universal, but the opening methods of the editor are also slightly different. This lecture is to tell you how to expand the formula editor.

FNC is the format of Great Wisdom 2 and Analyst, only these two stocks can be imported. The method of import is: open the formula editor, click Import - find the folder where the formula is stored - double-click - click the formula in the list that appears - select Import.

Special reminder: The formula must be stored in a folder first, whether it is an existing one or a new one. Otherwise the editor cannot find the formula.

ALG is the lattice file format of Feihu and Golden Fox software, exp format, tnc is Tongda Xinsoft's Great Wisdom Internet version format, hxf is the flush format, and the more special fml is the long and short front format ( The same suffix as Feihu’s self-compiled formula file)

Lecture 2: Basic functions for writing formulas

Open the technical indicator formula. Our most common one consists of two In this case, one is the K-line and the other is the moving average. Others such as columnar lines, ribbons, segmented lines, etc. are all extensions or deformations based on K-lines or moving averages. To do this, let's first familiarize ourselves with the basic functions that make up these two states.

1. K-line function

It is very simple and everyone may be familiar with it. As a basis, let me explain it.

1. Opening price: OPEN can be abbreviated as O

2. Highest price: HIGH can be abbreviated as H

3. Lowest price smi49liesOW can be abbreviated as L

4. Closing price: CLOSE can be abbreviated as C

With these four functions, a K-line can be formed. For example: the closing price is lower than the opening price, that is, the negative line: C

What about the bald positive line with a long lower shadow, that is, the T-shaped line? Once you understand the principle, it's very simple. First, it must close at the highest price (otherwise there will be an upper shadow), and second, the opening price must be greater than the lowest price. So it has the following expression: C=HANDO>L; here we do not consider the length of the lower shadow and the width of the horizontal line (solid part) above the T.

Exercise: A bald Yang line, the real part is less than 5 cents, and the lower shadow is more than twice the real body. How to express it?

Special note: Editing indicators must be entered in English. The mathematical symbols used, including addition, subtraction, multiplication and division, semicolons, quotation marks, etc. (+-*/; ""''><#) must also be entered in English.

2. Moving average function

The shape of a single K line is quite boring. Especially in the main image. Coupled with moving averages and other forms, it will be rich and colorful, or it may be more conducive for us to discover patterns and analyze problems. This requires the moving average function to solve.

The most common:

1. MA (X, N), find the N-period simple moving average of X.

Algorithm: (X1+X2+X3+...+Xn)/N

For example: MA (CLOSE, 20), which means finding the 20-day average price.

2. EMA (X, N), find the N-period exponential smoothing moving average of X.

Algorithm: If Y=EMA (X, N) then Y=[2*X+(N-1)*Y']/(N+1), where Y' represents the Y value of the previous period .

For example: EMA (CLOSE, 20), which means finding the exponential smoothing average price on the 20th day.

3. SMA (X, N, M), find the N-period moving average of X, M is the weight.

Algorithm: If Y=SMA(X, N, M) then Y=(M*X+(N-M)*Y')/N, where Y' represents the Y value of the previous period, and N must be greater than M.

For example: SMA (CLOSE, 20, 1), which means finding the 20-day moving average price.

These three moving average functions are common in stock soft stocks. Regarding their differences, you don’t need to go into details when you start learning. In fact, the numerical difference is not very big. If you want the moving average to truly reflect daily price changes, use MA. To be more diplomatic, use EMA or SMA.

3. Commonly used connection functions

With the above basic functions, K lines and moving averages can be expressed, but in actual applications it is much more complicated, and some functions are needed to connect them. stand up.

There are roughly the following:

1. AND means "and". For example: AANDB; that is, the two conditions A and B must be true at the same time.

2. OR means "or", "or". For example: AORB; it means that one of the two conditions A and B is true.

3. IF takes different values ??according to conditions. For example: IF (X, A, B), if X is not 0, return A, otherwise return B. Example: IF (C

4. CROSS crossover function. CROSS (A, B), indicating that A passes through B from bottom to top.

5. REF forward reference. Quote several Data before the cycle. For example: REF (CLOSE, 1), represents yesterday’s closing price. Then the highest price the day before yesterday is: REF (H, 2)

4. Trading volume

VOL represents the daily trading volume. Since it will be used frequently in the future, I will explain it to you first.

The above functions are the most commonly used. I hope you will remember them. I don’t know how to write them. You also need to know the meaning of its expression. Of course, it doesn't matter if you can't remember it. It's all in the "Formula Editor"

Exercise questions: The 10-day moving average and the 20-day moving average have a golden cross and an increase of more than 3%. , and the trading volume is doubled compared to yesterday.

Lecture 3: Understanding color symbols or drawing functions

The indicators we see are based on lines. , K-line, or the filling between lines and points are all inseparable from color. It is the color that makes the graphics colorful, easy to distinguish, or more three-dimensional.