Quantitative Zigzag Strategy
Overview
The purpose of this strategy is to test whether different input variables such as candlestick colors, volume and random methods can be used to predict price changes in the form of sine waves. The strategy converts these variables into sine wave forms. When the peaks or troughs reach the set number of times, buy or sell decisions are made.
Strategy Principle
The strategy is divided into three parts. The first part detects changes in candlestick colors. When a candle with a different color appears after several candles of the same color, the sine wave turns direction. The second part detects whether the volume is higher or lower than the average. When the average is broken, the wave turns direction. The third part uses a random method to simulate coin flipping. When the random result is different, the wave turns direction. When these three waves accumulate to the set number of times, trading decisions are made.
The code controls the running of the waves by tracking the current direction, number of peaks, and situation of the previous candlestick for the three waves. When the number of peaks reaches the parameter setting, it changes the running direction. This loop simulates the running of sine waves.
Advantage Analysis
This sine wave theory seems to make sense, and the simulated waveforms also have some correlation with the real market. But through the test of this strategy, it can be found that they are actually random results. Which combination of variables makes the waveform look more similar does not improve trading results.
So one advantage of this strategy is to refute the misconception that "the market can be predicted". Variables in the market do affect prices, but they are unpredictable, and random decisions can also obtain similar results.
Risk Analysis
The biggest risk of this strategy is that it is difficult to determine profit and loss in random trading. The results under different parameters are also difficult to predict, and it is impossible to determine in advance whether it can be profitable.
In addition, the sine wave prediction theory itself is wrong. Market changes are too complex to simulate with simple cyclicity. So this strategy cannot really be used for actual trading.
To reduce risks, it is necessary to further analyze the random results to determine the parameter range; or combine other analytical methods to verify trading signals.
Optimization Directions
This strategy can be optimized in the following directions:
- Increase more variables converted into waves to expand the sample space
- Combine the three current waves to find the best traversal combination
- Set stop loss methods, such as percentage loss stops
- Optimize entry and exit logic and backtest to find optimal parameters
Summary
Through testing different sine waves, this strategy illustrates the unpredictable nature of the market. At the same time, it also refutes the erroneous theory of using wave cycles to predict.
Next, the practicality of the strategy can be improved by increasing variables, combining waveforms, setting stops, and optimizing parameters. But the key is still to understand that market changes are complex and unpredictable. What we need to do is reduce random risks rather than predict the market.
- 1

