Principle and compilation of stop-loss model (1)

in fmz •  last year 

Why stop-loss?

1.png

Alligator Principle

Suppose a crocodile bites your feet. If you try to break free your feet with your hands, the crocodile will bite your feet and hands at the same time. The more you struggle, the more you will be bitten. So, if the crocodile bites your feet, your only chance is to sacrifice one foot.

In the capital market, whether it is digital currency or commodity futures, the Alligator Principle is that when you find that your transaction deviates from the direction of the market, you must stop the loss immediately without any delay or any luck.

Preserving your capital always comes first!

Investment tycoon

I believe that the most important thing is always to preserve capital, which is the cornerstone of the investment strategy.

Failed investors

The only investment goal is to "make a lot of money". As a result, he often could not preserve his capital.

Investment tycoons know that it is easier to avoid losing money than to make money. If you lose 50% of your investment capital, you must double your capital to return to the original starting point.

2.png

3.png

Spatial stop-loss method

The key is to set the stop-loss price above or below a certain benchmark position to achieve a preventive approach.

For example:

Long stop-loss - set stop-loss below the support line based on the support line;
Short stop-loss - set a stop-loss above the resistance line based on the resistance line.

This stop-loss method belongs to the price model method, which is equivalent to setting the "maximum limit" of stop-loss, in order to protect yourself and avoid the disaster caused by emotional interference. After we established our position, if we wait passively for the price to fall to the maximum stop-loss line, you will be passive. The preset maximum stop-loss limit can only play a very good role in blocking when the market changes direction suddenly.

Limit and stop-loss method

stop-loss strategy: the stop-loss position is preset before opening the position.

Strategy example: stop-loss at a fixed price point, and stop-loss at 3% or 5% below the buying price. Once the price falls below the stop-loss position effectively, leave the market immediately. The "effective decrease" here refers to the closing price generally.

Follow the trend floating stop-loss method

Stop-loss strategy: based on the profit and loss at the time of setting the stop-loss, stop-loss after withdrawing N price points from the maximum profit and loss.

Strategy example: if you make a long order for PTA at 8946, and set the stop-loss when the price goes back to 10 (8936), when the PTA price rises to 8950, the stop-loss price will be repositioned at 8940 automatically.

Withdrawal stop-loss method
If the price rises first after buying, and then falls after reaching a relative high point, then you can set the decline range from the relative high point as the stop-loss target, and the specific value of this range is also determined by your personal situation. In addition, we can also add the factor of decreasing time (i.e. days). For example, we set a stop-loss by withdrawing 5% within 3 days. The withdrawal stop-loss is more often used in the case of stop profit actually.

4.png

Introduction to modern stop-loss methods

Time stop-loss method

Application: intra-day ultra-short trading mode

Key: After the position is established, there is no favorable fluctuation in the market for a certain period of time, stop-loss and leave the market, and look for the opportunity to enter the market again.

Trading principle: When the price moves sharply in an instant under the influence of certain factors, such as the impact of the external market, the breakthrough and false breakthrough of the intraday support level and pressure level, and the sudden news, the profit can be earned by quick entry and exit in the trend or against the trend.

The practice of time stop-loss is forward-looking and belongs to other stop-loss methods. Time stop-loss also involves the issue of opening time. For example, we should strive to open the position at the moment of starting the critical point (the qualitative change point), and expect that there will be a frenzy of buying the winners, but it's only an expectation. If it does not happen, then we should close the position and leave the market, and do not wait until the decrease support or crossover resistance before stopping the loss.

Typical time stop-loss:

Horizontal stop-loss

  • Stop-loss strategy: set a stop-loss target for the time that the price crosses within a certain range after buying.

  • Strategic distance: stop-loss if the increase rate does not reach 5% within 5 days after buying.

  • Generally, horizontal stop-loss requires time stop-loss and maximum loss method to be used at the same time to control the risk comprehensively.

5.png

6.png

Technical stop-loss method

Key: The technical stop-loss method is a more complex stop-loss method. It combines the stop-loss setting with the technical analysis. After eliminating the random fluctuation of the market, it sets the stop-loss order at the key technical level to avoid further expansion of the loss.

Application: The technical stop-loss method requires investors to have strong technical analysis ability and self-control. Compared with the former method, the technical stop-loss method has higher requirements for investors, and it is difficult to find a fixed model. Generally speaking, using the technical stop-loss method is nothing more than small losses to bet great profits.

For example, after buying off the track of the increasing channel, wait for the end of the increasing trend to close the position, and set the stop-loss position near the relatively reliable average moving line, so that you can get the price difference by entering in low position and exiting in high position.

Typical technical stop-loss:

Trend tangent stop-loss:

Including the tangent of the price effectively falling below the trend line; The price effectively breaks Gann angle line 1 × 1 or 2 × 1 line; The price effectively breaks through the lower track of the increasing channel.

Morphological stop-loss:

Including the stock price broke the neckline level of the head and shoulders, M-head, round top and other head patterns; price jumped down to break the gap, etc.

K-line stop-loss:

Including short shots with two negative lines sandwiched with one positive line, and one negative line followed by two negative and positive lines, or full covered status with one negative line break three lines, and the appearance of the typical K-line combinations, such as twilight star, the 2nd K-line piercing the 1st K-line all, the stars of shooting, the two flying crows, and the three crows hanging on treetops and so on.

Index stop-loss:

According to the technical indicators issued by the sell instructions, as a stop-loss signal, mainly including: MACD appeared green bar and formed a down cross; SAR down below the turning point and turned green, etc.. One of the simplest and most practical is the SAR Parabolic Turn indicator, also known as the Stop-Loss Point Turn operating system. SAR is like the patron saint of stock prices, once the upward speed can not keep up, or the stock price reverses down, SAR will keep a close eye on, if the stock price falls below SAR, it's the signal to close the position.

7.png

8.png

9.png

Statistical stop-loss method

In the selection of reference materials for stop-loss, we can select various reference standards. In addition to technical indicators, K-line shape, time and price space, many statistical variables are also important reference standards for setting stop-loss. Most of these statistical variables are based on statistics and mathematical principles, so we call them statistical stop-loss temporarily.

Typical statistical stop-loss:

Capital stop-loss-method:

This is the simplest stop-loss method. We control the risk at a fixed proportion of capital in each transaction. When we make money continuously, the proportion represents that the amount will increase, so we can invest more capital to make more profits. When we lose money continuously, we may reduce the loss on the contrary.

10.png

Compilation method of stop-loss model

Write several common stop-loss functions:

BKPRICE Return to the signal price of the last buying and opening of the data contract.
SKPRICE Return to the signal price of the last selling and opening of the data contract.
BKHIGH Return to the highest price from the last model buy opening position to the current one.
SKLOW Return to the lowest price from the last model sell opening position to the current one.
BARSBK Last buy opening signal position
BARSSK Last sell opening signal position

Limit price to stop-loss and stop-profit

TMP1:=C<BKPRICE-M;
TMP2:=C>SKPRICE+M;

TMP3:=C>BKPRICE+M;
TMP4:=C<SKPRICE-M;

Trailing stop-loss

HH:HHV(H,BARSBK); // High point since entering the market
LL:LLV(L,BARSSK); // Low point since entering the market
TMP1:=C<(HH-BKPRICE)*0.5+BKPRICE&&HH>BKPRICE+25; // Long position trailing stop-loss conditions
TMP2:=C>SKPRICE-(SKPRICE-LL)*0.5&&LL<SKPRICE-25; // Short position trailing stop-loss conditions

Examples of stop-loss models

Example 1: Double SMA System

Idea: Buy or sell when the 100-day SMA crosses the 350-day SMA

MA1:MA(C,100);
MA2:MA(C,350); // Define double SMA
CROSS(MA1,MA2),BPK;
CROSS(MA2,MA1),SPK;
AUTOFILTER;

Thinking

  • If the conditions for crossing the closing positions have not been met and the trend has reversed, can we stop-loss immediately to reduce losses?

  • If it is profitable, can it maximize profit and let the position of closing position rise with the market?

Conversion: price limit stop-loss + trailing stop-profit

// price limit stop-loss
C<BKPRICE-N,SP;
C>SKPRICE+N,BP;
// trailing stop-profit
C>BKPRICE&&C<BKHIGH-M,SP;
C<SKPRICE&&C>SKLOW+M,BP;
Note: N and M are price differences

Complete code:

MA1:MA(C,100);
MA2:MA(C,350); // Define double SMA
CROSS(MA1,MA2),BK;
CROSS(MA2,MA1),SK; // Conversion model
CROSS(MA2,MA1)||C<BKPRICE-N||(C>BKPRICE&&C<BKHIGH-M),SP;
CROSS(MA1,MA2)||C>SKPRICE+N||(C<SKPRICE&&C>SKLOW+M),BP;
 // Limit price stop-loss + withdrawal stop-loss
AUTOFILTER; // Realize signal filtering

11.png

12.png

To be continued...

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!