Using Mann-Kendall Test after nearly 1 year
Intro:
Background:
I posted about using the Mann-Kendall Test to predict trends about a year ago (link). Since my first encounter with using the model, I made some adjustments. First, I started collecting live pricing by one minute (close to one min). Given their volatility, trade frequencies, and open trade hours, I focused on the frequencies for one minute. Using the data, I ran the Mann-Kendall Test using Python every 1500 increments. I focused on the z-score. A positive z-score shows that there's an upward trend, and a negative z-score shows that there's a downward trend. Zero would indicate no trend. I could use different increments to see upward or downward trends.
Findings:
I tested in many different ways, and I found some correlations. For instance, the -40 z-score indicates the lowest level it can go. At some point, the prices will start to rise. Of course, the problem is how much it would increase. The example 1 graph below shows that during a long-run price depreciation, the price won't go as high to offset the buy price. So the risk of buying during the long-run price depreciation is too high to enter the market.
To take advantage of the volatility, we would have to sell once the z-score reaches +40. During the long-run price appreciation, buying after the z-score goes -40 can increase your return quickly. Example 2 shows where you could buy and sell (green vertical line = buy and blue vertical line = sell).
Example 2 - Long-run price appreciation
Example 2 - Long-run price appreciation
Next Steps:
My next step is to run the z-score on a longer increment than 1500. That could provide a better long-run trend so that I can avoid entering the market when the average price is heading down, as shown in example 1. The strategy will be simple. I want to predict and create the following:
- Is the price heading up/down in the long run - the new longer increment model should help?
- If up, then buy.
- If down, then stay out.
- When is the best time to buy and sell?
- The z-core is -40, and moving upward indicates buy opportunities.
- Sell when the z-score is +40 and moving downwards.
- How long to hold?
- Based on example 2, I could buy on the vertical green line but wait longer for a higher return per trade.
- I could also buy and sell more often for a higher return during the same period. I would also reduce the risk of unexpected price depreciation in the future. However, I could have much less return if I missed my time to sell.
- Use historical data to identify the best time to buy and sell:
- When is the best time to buy and sell? I could find possible scenarios to create a risk meter. Let's say a 2.5% return is best in the short run. If so, I would calculate my actual bought price compared to the lowest price. Then calculate the highest possible price to sell.
- Can all these things be automated? We shall see!
Comments
Post a Comment