A stock transaction decision method, system and readable storage medium thereof
Patent Information
- Application Number
- CN202610972770.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-01
- Publication Date
- 2026-10-16
AI Technical Summary
但是这种单一的判断方式存在明显的滞后性,往往在趋势已经启动一段后才发出信号,导致入场成本过高
[0031] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: the present invention uses the slope of long-term and short-term moving averages, the trading volume of the current trading date, and K-line attributes to make a comprehensive judgment from multiple dimensions; thus improving the accuracy and anti-interference ability of trading signals.
Abstract
Description
Technical Field
[0001] This invention belongs to the field of stock analysis technology, specifically relating to a stock trading decision-making method, system, and its readable storage medium. Background Technology
[0002] In recent years, quantitative trading technology has been widely used in global financial markets. As the structure of securities market participants becomes increasingly institutionalized, algorithmic trading methods based on technical indicators have also become an important tool for investors to capture market opportunities.
[0003] In traditional technical analysis systems, moving averages are a common trend-following tool. Current techniques typically use single-period moving averages as buy / sell signals; for example, buying when a short-term moving average crosses above a long-term moving average, and selling when they cross below. However, this single-period approach has a significant lag, often issuing signals only after a trend has already begun, leading to excessively high entry costs. Regarding the identification of candlestick patterns (such as engulfing patterns and morning stars), traditional methods rely heavily on manual monitoring or simple shape matching, lacking integration with dynamic indicators (such as rate of change and slope).
[0004] To address the existing problems, we propose a stock trading decision-making method, system, and its readable storage medium.
[0005] The information disclosed in this background section is only for understanding the background technology of the inventive concept, and therefore may include information that does not constitute prior art. Summary of the Invention
[0006] To address the technical problems mentioned in the background section, the present invention provides the following technical solution:
[0007] On the one hand, this disclosure provides an embodiment of a stock trading decision-making method comprising the following steps:
[0008] Obtain multi-period market data for the target trading instrument. The market data should include at least the opening price, highest price, lowest price, closing price, trading volume, and timestamp.
[0009] Based on market data, long-term moving averages and short-term moving averages are calculated separately, and the normalized rate of change is calculated separately. The normalized rate of change is the percentage change rate of the real-time moving average value relative to the previous moment. The long period is a K-line period with an interval of 30-60 minutes, and the short period is a K-line period with an interval of 5-10 minutes.
[0010] Calculate the slope of the long-term moving average and define it as the first slope. Calculate the slope of the short-term moving average and define it as the second slope. Determine the trend of the long-term moving average based on the first slope of the long-term moving average at the current moment and the current price. Determine the trend of the short-term moving average based on the second slope of the short-term moving average at the current moment and the current price.
[0011] Calculate the volume-weighted average price for the current trading day. The price difference between the current price and the volume-weighted average price is the deviation.
[0012] Identify candlestick attribute signals within a preset time period, which is the time period of the 1-5 candlesticks most recent to the current time.
[0013] The moving average slope signal, deviation signal, and K-line attribute signal are weighted and fused together. If the three signals resonate, a trading order is generated.
[0014] As an optional implementation, the long-term moving average has a period length of 50-200 periods, and the short-term moving average has a period length of 5-20 periods.
[0015] As an optional implementation, the resonance triggering conditions include:
[0016] The first indicator is that when the first slope is greater than 0 and the closing price is above the long-term moving average, it is considered an uptrend; when the first slope is less than 0 and the closing price is below the long-term moving average, it is considered a downtrend.
[0017] The second indicator is that the first slope and the second slope are both positive or both negative, and the absolute value of the second slope increases continuously.
[0018] The third indicator is when the price breaks through or falls below the long-term moving average.
[0019] The fourth indicator is that the deviation and the second slope are both positive or both negative.
[0020] The fifth indicator is a bullish or bearish signal based on candlestick chart attributes.
[0021] As an optional implementation method, bullish signals for candlestick attributes include one of the following: Sun line, Sun upper shadow line, Sun lower shadow line, Morning Star, Rising Sun, Inverted Hammer, and Three Inner Circles; bearish signals for candlestick attributes include one of the following: Hanging Man, Shooting Star, Bearish Breakaway, Evening Star, Long Doji, or Continuous Decline.
[0022] As an optional implementation, a buy order is generated when the first slope is greater than 0 and the current closing price is above the long-term moving average, the second slope is greater than 0 and the absolute value of the second slope increases more than 3 times consecutively; the current price is higher than the daily volume-weighted average price; and a bullish pattern appears in the 5-20 K-lines closest to the current price.
[0023] On the other hand, this disclosure provides an embodiment of a stock trading decision system comprising:
[0024] The market data acquisition module retrieves the opening price, highest price, lowest price, closing price, trading volume, and timestamp data of the target trading instrument.
[0025] The calculation module calculates long-term and short-term moving averages and their normalized rate of change; it also calculates the first slope of the long-term moving average and the second slope of the short-term moving average.
[0026] The VWAP calculation and deviation monitoring module is configured to calculate the volume-weighted average price (VWAP) for the current trading day and monitor...
[0027] Measure the deviation between the current price and VWAP;
[0028] The candlestick attribute recognition module identifies candlestick attributes.
[0029] The judgment module weights and fuses the moving average slope signal, deviation signal, and K-line attribute signal to generate a trading order.
[0030] On the other hand, this disclosure provides an embodiment of a stock trading readable storage medium storing a computer program thereon, which, when executed by a processor, implements stock trading decisions based on the above-mentioned multi-dimensional composite indicators.
[0031] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: the present invention uses the slope of long-term and short-term moving averages, the trading volume of the current trading date, and K-line attributes to make a comprehensive judgment from multiple dimensions; thus improving the accuracy and anti-interference ability of trading signals.
[0032] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Detailed Implementation
[0033] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] Example 1:
[0035] A stock trading decision-making method, the steps of which are as follows:
[0036] 1) Obtain multi-period market data for the target trading instrument, including opening price, highest price, lowest price, closing price, trading volume, and timestamp;
[0037] 2) Define the K-line period with a 30-minute interval as the long period, with a moving average period of 50 periods; define the K-line period with a 5-minute interval as the short period, with a moving average period of 5 periods. Calculate the long-period moving average and the short-period moving average separately, and calculate the normalized rate of change for each; the normalized rate of change is the percentage change of the real-time moving average value relative to the previous moment.
[0038] 3) Calculate the slope of the long-term moving average and define it as the first slope. Calculate the slope of the short-term moving average and define it as the second slope. Determine the trend of the long-term moving average based on the first slope of the long-term moving average at the current moment and the current price. Determine the trend of the short-term moving average based on the second slope of the short-term moving average at the current moment and the current price.
[0039] 4) Calculate the volume-weighted average price for the current trading day. The price difference between the current price and the volume-weighted average price is the deviation.
[0040] 5) Identify K-line attribute signals within a preset time period, which is the time period of the 1-5 K-lines closest to the current time.
[0041] 6) The moving average slope signal, deviation signal and K-line attribute signal are weighted and fused together to obtain the first indicator, the second indicator, the third indicator, the fourth indicator and the fifth indicator.
[0042] The first indicator is defined as follows: the first slope is greater than 0 and the closing price is above the long-term moving average. The second indicator is defined as follows: the first slope and the second slope are both positive, and the absolute value of the second slope increases continuously. The third indicator is defined as follows: the real-time price breaks through or falls below the long-term moving average. The fourth indicator is defined as follows: the fourth indicator is defined as the deviation and the second slope are both positive. The fifth indicator is defined as follows: a sun line appears in the two nearest K-lines.
[0043] A buy order should be placed when all five indicators exhibit the above characteristics.
[0044] It should be explained that in the fifth indicator, if one or more of the following patterns appear in the two nearest K-lines: Sun Line, Sun Upper Shadow Line, Sun Lower Shadow Line, Morning Star, Rising Sun, Inverted Hammer Line, or Three Inner Lines, it is equivalent to the appearance of a Sun Line in the two nearest K-lines.
[0045] Example 2:
[0046] A stock trading decision-making method, the steps of which are as follows:
[0047] 1) Obtain multi-period market data for the target trading instrument, including opening price, highest price, lowest price, closing price, trading volume, and timestamp;
[0048] 2) Define the K-line period with a 60-minute interval as the long period, with a moving average period of 200 periods. Define the K-line period with a 10-minute interval as the short period, with a moving average period of 20 periods. Calculate the long-period moving average and the short-period moving average separately, and calculate the normalized rate of change for each. The normalized rate of change is the percentage change of the real-time moving average value relative to the previous moment.
[0049] 3) Calculate the slope of the long-term moving average and define it as the first slope. Calculate the slope of the short-term moving average and define it as the second slope. Determine the trend of the long-term moving average based on the first slope of the long-term moving average at the current moment and the current price. Determine the trend of the short-term moving average based on the second slope of the short-term moving average at the current moment and the current price.
[0050] 4) Calculate the volume-weighted average price for the current trading day. The price difference between the current price and the volume-weighted average price is the deviation.
[0051] 5) Identify K-line attribute signals within a preset time period, which is the time period of the 1-5 K-lines closest to the current time.
[0052] 6) The moving average slope signal, deviation signal and K-line attribute signal are weighted and fused together to obtain the first indicator, second indicator, third indicator, fourth indicator and fifth indicator.
[0053] The first indicator is when the first slope is less than 0 and the closing price is below the long-term moving average; the second indicator is when both the first and second slopes are negative, and the absolute value of the second slope increases continuously; the third indicator is when the real-time price falls below the long-term moving average; the fourth indicator is when both the deviation and the second slope are negative; and the fifth indicator is when a shooting star appears in the two closest candlesticks.
[0054] When all five indicators exhibit the above characteristics, a sell transaction should be initiated.
[0055] It should be explained that in the fifth indicator, if one or more of the following patterns appear in the two nearest K-lines: Hanging Man, Bearish Breakaway, Evening Star, Long Doji, or Continuous Decline, it is equivalent to the appearance of a Shooting Star in the two nearest K-lines.
[0056] Example 3:
[0057] 1) Obtain multi-period market data for the target trading instrument, including opening price, highest price, lowest price, closing price, trading volume, and timestamp;
[0058] 2) Define the K-line period with a 40-minute interval as the long period, with a moving average period of 50-200 periods. Define the K-line period with a 5-10 minute interval as the short period, with a moving average period of 5-20 periods. Calculate the long-period and short-period moving averages separately, and calculate the normalized rate of change for each. The normalized rate of change is the percentage change of the real-time moving average value relative to the previous moment.
[0059] 3) Calculate the slope of the long-term moving average and define it as the first slope. Calculate the slope of the short-term moving average and define it as the second slope. Determine the trend of the long-term moving average based on the first slope of the long-term moving average at the current moment and the current price. Determine the trend of the short-term moving average based on the second slope of the short-term moving average at the current moment and the current price.
[0060] 4) Calculate the volume-weighted average price for the current trading day. The price difference between the current price and the volume-weighted average price is the deviation.
[0061] 5) Identify K-line attribute signals within a preset time period, which is the time period of the 5-20 K-lines closest to the current time.
[0062] 6) The moving average slope signal, deviation signal and K-line attribute signal are weighted and fused together to obtain the first indicator, second indicator, third indicator, fourth indicator and fifth indicator.
[0063] The first indicator is when the first slope is less than 0 and the closing price is below the long-term moving average; the second indicator is when the first slope is positive but the second slope is negative, and the absolute value of the second slope increases continuously; the third indicator is when the real-time price is higher than the long-term moving average; the fourth indicator is when the deviation is positive and the second slope is negative; the fifth indicator is when a shooting star appears in the two closest K-lines.
[0064] When all five indicators exhibit the above characteristics, a sell transaction should be initiated.
[0065] It should be explained that in the fifth indicator, if one or more of the following patterns appear in the two nearest K-lines: Hanging Man, Bearish Breakaway, Evening Star, Long Doji, Continuous Decline, Sun Line, Upper Shadow of the Sun, Lower Shadow of the Sun, Morning Star, Rising Sun, Inverted Hammer, or Three Inner Lines, it is equivalent to the appearance of a Shooting Star in the two nearest K-lines.
[0066] Although embodiments of the invention have been shown and described (see the detailed description above), it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A stock trading decision-making method, characterized in that, Includes the following steps: Obtain multi-period market data for the target trading instrument, wherein the market data includes at least the opening price, highest price, lowest price, closing price, trading volume, and timestamp; Based on the market data, long-term moving averages and short-term moving averages are calculated respectively, and normalized rate of change is calculated for each. The normalized rate of change is the percentage change rate of the real-time moving average value relative to the previous moment. The long period is a K-line period with an interval of 30-60 minutes, and the short period is a K-line period with an interval of 5-10 minutes. The slope of the long-term moving average is calculated and defined as the first slope, the slope of the short-term moving average is calculated and defined as the second slope, the trend of the long-term moving average is determined based on the first slope of the long-term moving average at the current moment and the current price, and the trend of the short-term moving average is determined based on the second slope of the short-term moving average at the current moment and the current price. Calculate the volume-weighted average price for the current trading day. The price difference between the current price and the volume-weighted average price is the deviation. Identify K-line attribute signals within a preset time period, wherein the preset time period is the time period of the 1-5 K-lines most recent to the current time; The moving average slope signal, deviation signal, and K-line attribute signal are weighted and fused together. If the three signals resonate, a trading order is generated.
2. The stock trading decision-making method according to claim 1, characterized in that, The resonance triggering conditions include: The first indicator is defined as follows: when the first slope is greater than 0 and the closing price is above the long-term moving average, it is considered an uptrend; when the first slope is less than 0 and the closing price is below the long-term moving average, it is considered a downtrend. The second indicator is that the first slope and the second slope are both positive or both negative, and the absolute value of the second slope increases continuously. The third indicator is a price breakout or breakdown below the long-term moving average. The fourth indicator is that the deviation and the second slope are both positive or both negative. The fifth indicator is the K-line attribute signal indicating whether it is bullish or bearish.
3. The stock trading method according to claim 4, characterized in that, The bullish signals of the candlestick chart include one of the following: Sun candlestick, Sun upper shadow, Sun lower shadow, Morning Star, Rising Sun, Inverted Hammer, and Three Inner Candles; the bearish signals of the candlestick chart include one of the following: Hanging Man, Shooting Star, Bearish Breakaway, Evening Star, Long Doji, or Continuous Decline.
4. The stock trading decision-making method according to claim 1, characterized in that, A buy order is generated when the first slope is greater than 0 and the current closing price is above the long-term moving average; the second slope is greater than 0 and the absolute value of the second slope increases more than 3 times consecutively; the current price is higher than the daily volume-weighted average price; and a bullish pattern appears in the 5-20 K-lines closest to the current price.
5. A stock trading decision-making system, characterized in that the system... include: The market data acquisition module retrieves the opening price, highest price, lowest price, closing price, trading volume, and timestamp data of the target trading instrument. The calculation module calculates long-term and short-term moving averages, and calculates the normalized rate of change for each. Calculate the first slope of the long-term moving average and the second slope of the short-term moving average; The VWAP calculation and deviation monitoring module is configured to calculate the volume-weighted average price (VWAP) for the current trading day and monitor the deviation between the current price and VWAP. The candlestick attribute recognition module identifies candlestick attributes. The judgment module performs a weighted fusion of the moving average slope signal, the deviation signal, and the K-line attribute signal to generate a trading order.
6. A stock trading readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the stock trading decision method according to any one of claims 1 to 4.