One of the things I have learned when coding Trademinator is that you can not have the same strategy when you have a bulling or bearing market. When a market is bulling, the smartest thing you could do is holding until you reach an inflection point before selling; when you are in a bearing market, you sell to prevent losses as soon as possible.
There are many ways to detect the trend: bearish, neutral, bullish. The DMI and ADX metrics are for that, but they require CPU power. After giving a thought, I came with one solution from my own which it requires much less CPU. I will talk about one I have come myself.
The Greater-Smaller Technique
The idea behind this technique is very simple. You compare two values from the ticker or functions from the ticker. The function is like the PHP or C strcmp function; it returns -1 if less, 0 if equal or 1 if greater. Run this function for the last N candlesticks. After that, a simple statistic work will let you know the trend. I use the SMA(20) in the closing candle or the EMA(20) in the closing as well. You can also change the last candlesticks to analyze, I use twenty as the Bollinger bars use it by default; no need to rediscover things.
For example, in the following image, visually speaking it is clearly a bullying trend. However, we need to do this analytically. The red line is the SMA(20, close) function.
If we run a statistic analysis, we will have:
- 20 closing candlesticks are greater than SMA, which it means 100% uptrend
- 0 closing candlesticks are smaller than SMA, which it means 0% downtrend
Now, look the following graph. Visually speaking it is a neutral trend, it does not go up or down constantly.
After running the statistic analysis, we have:
- 12 closing candlesticks are treater than SMA, which it means 60% uptrend
- 8 closing candlesticks are smaller than SMA, which it means 40% downtrend
Experience has shown me that if there is no trend with a majority of 75%, then it can be declared as neutral.
Check the last graphic. A clear bearing trend.
The statistic analysis shows us that:
- 1 closing candlestick is greater than the SMA, which it means 5% uptrend
- 19 closing candlesticks are smaller than SMA, which it means 95% downtrend
Now that you know the trend without watching the candle graph, you can decide your strategies. For example, here there are some ideas:
- if bullish, sell a little, buy a lot
- if neutral, sell a lot, buy the half
- if bearing, sell a lot, buy a little
Good luck!blog comments powered by Disqus