The SuperTrend indicator is simply one of the easiest trend trading systems. It was developed by Olivier Seban and is a trend following indicator used for technical analysis. It uses the Average True Range (ATR) which takes into account the volatility of the market. Nonetheless, it does give fake signals in sideways moving markets. Therefore, we will use the concept of market cycles with Linear Regression to confirm a trending market first and then use SuperTrend to generate buy/sell signals for our SuperTrend Trading Strategy on Mudrex.
What is the SuperTrend Indicator?
The SuperTrend Indicator is plotted over the price chart of the stock or the index. The indicator line changes its colour between green and red based on the price moment in the underlying asset. When the stock price turns greater than the indicator value, a buy signal can be generated. The indicator colour then turns green and you can also see a crossover of the price above the indicator. When the stock price turns lesser than the indicator value, it generates a sell signal. The indicator colour then turns red and you can also see a crossover of the price below the indicator.
What are the Parameters for the SuperTrend Indicator?
Calculation of the SuperTrend signal line is a bit complicated, as it consists of multiple if-else conditions. You can find the formula here. The final signal is constructed with the help of just two parameters- period and multiplier.
The default parameters are 10 for the period of Average True Range (ATR) and 3 for its multiplier.
Some points to note are:
- The SuperTrend indicator can be more reactive to price through smaller settings, ensuring more signals
- Higher settings will eradicate the noise from the market but will have to risk fewer trading signals
SuperTrend does not predict the direction but guides you to initiate and stay in a position till the trend sustains. This is where the Linear Regression of the stock price comes into play.
Linear Regression takes various data points in a sample and providing a “best fit” line to match the general trend in the data using the least square fitting method. Traders go long when the Linear Regression Indicator turns up, and they go short when this indicator turns down. The Linear Regression line hints at where the price would be expected making the indicator more responsive than a moving average.
The Magic of Market Cycles
Markets move in four phases; understanding how each phase works and how to benefit is the difference between floundering and flourishing.
- Accumulation Phase: The market has bottomed, and early adopters see an opportunity to jump in and enter the trade at the very beginning of the trend.
- Mark-up Phase: When the market seems to be trending up, and the bullish sentiment continues before consolidation at the top.
- Distribution Phase: Sentiment turns mixed to slightly bearish, prices are choppy, sellers prevail, and the end of the trend is near.
- Mark-down Phase: Active traders try to sell and exit their trades, while early adopters look for signs of a bottom so they can get back in.
A market cycle can last from a few weeks to a number of years, depending on the market and the time frame. While there is no way to predict the duration of a particular phase, we can believe that the phases will occur in a cycle. Using Linear Regression, we can make profits off the trending markets during the mark-up and mark-down phase while closing our trades during the consolidated accumulation and distribution phase.
We will be using Linear Regression as a filter to identify the market direction. The Linear Regression line is a statistical tool that identifies the best straight line fit through the price. The smaller the look-back period of Linear Regression, the more closely it follows the price. However, since we only want to detect the slope of the line, we will use a large enough look back period which gives us fairly smooth results.
We’ll use the comparison of the SuperTrend signal and the Closing Price to generate buy and sell signals once the predominant trend is established.
- Predominant uptrend is confirmed when the slope of the Linear Regression line is positive. This can be done by checking that the current value of the Linear Regression line is greater than the value in the near past.
- Once the uptrend is established, enter the trade when the Closing Price is greater than the SuperTrend signal. That is, the colour of the SuperTrend signal is green.
- A predominant downtrend is confirmed when the slope of the Linear Regression line is negative. This can be done by checking that the current value of the Linear Regression line is less than the value in the near past.
- Once the downtrend is established, exit the trade when the closing price is lesser than the SuperTrend signal. That is, the colour of the SuperTrend signal is red.
Using SuperTrend Trading Strategy On Mudrex
One of the most important factors which determine the success or failure of this strategy is setting up suitable parameters for both SuperTrend and Linear Regression. The parameters will highly vary with the time frame in which you want to trade. Therefore, running multiple backtests on Mudrex can help you decide the choice of parameters suitable to your trading style.
In the following example, we’ll use the lookback period of Linear Regression as 50. We will compare it with the value 5 candles ago to detect the slope. On the other hand, the SuperTrend ATR lookback period is taken as 20 while the multiplication factor is 2. As discussed above, let us first write our entry/exit conditions so that we know what to do while building our strategy:
- Linear Regression (Current) > Linear Regression (5 Candles Ago)
- Closing Price greater than equal to SuperTrend Value (Green)
- Linear Regression (Current) < Linear Regression (5 Candles Ago)
- Closing Price lesser than equal to SuperTrend Value (Red)
We’ll be using a stop-loss of 15% to prevent losing trades due to the generation of false signals.
To construct the first buy condition of Linear Regression (Current) > Linear Regression (5 Candles Ago), we’ll use a compare block that looks like this:
Compare block for the second buy condition to generate a buy signal when Closing Price is greater than equal to SuperTrend Value looks like this:
Joining these two blocks with an AND block will make our buy signal look like this:
Similarly, we can confirm the sell signal by reversing the operators in each of the compare blocks. The overall strategy with a stop loss of 15% looks like this:
And it is done!
We can now run a quick backtest to see how our strategy performs. Running one from over the past 1.5 years using a tick cycle of 12H gives us quite amazing results:
Changing the filter from the Linear Regression to EMA can show an improvement in this strategy over the assessment period. However, using the concept of Linear Regression in itself is a unique and interesting method to set the predominant trend and has its own benefits.
Reverse Opening of Trades (Additional)
Another feature that you can try out on Mudrex is preventing “Reverse Opening of Short/Long Trades”. What this means is, since we only have one buy and sell condition respectively, opening of long trades while closing of short trades is done when the buy signal is called. Whereas, the closing of long trades and opening of short trades is done when the sell signal is called.
Now technically, closing of long trades should simultaneously open up a short trade, because sell signal is called when a bearish trend is expected and we should logically be betting against the price. This is called “reverse open of long to short”. Whereas, closing of short trade should simultaneously open a long trade since buy signal is called when a bullish trend is expected and we should be betting for the price. This is called “reverse open of short to long”.
However, if we now take the market cycle into consideration, it is very clear that every uptrend need not be followed by a downtrend right away and vice versa. We might not want to enter a short trade right after closing a long trade because of consolidated prices in accumulation and distribution phases between every uptrend and downtrend. To do this, uncheck the box of “reverse open long to short” or vice versa in the buy/sell signal path details dialogue box as shown:
You can do a lot more complex things on Mudrex! Signup today!
A few quick references below:
- Register on Mudrex now and get credits worth $25 absolutely free: https://bit.ly/2WDdar2
- Support and FAQs: https://support.mudrex.com/hc/en-us
- Connect on our Discord: https://discord.gg/huZz3qP