New Breed of Technical Indicators — Indigo
Discussing a New Technical Indicator and Coding it in TradingView
This article discusses one of the indicators of a set called the Rainbow Indicators which are structured and unique combinations of price-derived techniques aimed to help the trader predict reversals or to confirm the on-going trend. The indicator discussed is called the Indigo indicator, a contrarian method based on the concept of slopes.
For a detailed and thorough collection of contrarian trading strategies, you can check out my book. The book features a huge number of classic and modern techniques as it dwelves into the realm of technical analysis with different trading strategies. The book comes with its own GitHub.
Contrarian Trading Strategies in Python
Amazon.com: Contrarian Trading Strategies in Python: 9798434008075: Kaabar, Sofien: Booksamzn.to
Creating the Indigo Indicator
One of the pillars of descriptive statistics is the normal distribution curve. It describes how random variables are distributed and centered around a central value. It often resembles a bell.
Some data in the world are said to be normally distributed. This means that their distribution is symmetrical with 50% of the data lying to the left of the mean and 50% of the data lying to the right of the mean. Its mean, median, and mode are also equal as seen in the below curve.
The above curve shows the number of values within a number of standard deviations. For example, the area shaded in red represents around 1.33x of standard deviations away from the mean of zero. We know that if data is normally distributed then:
About 68% of the data falls within 1 standard deviation of the mean.
About 95% of the data falls within 2 standard deviations of the mean.
About 99% of the data falls within 3 standard deviations of the mean.
Presumably, this can be used to approximate the way to use financial returns data, but studies show that financial data is not normally distributed. For the moment, we can assume it is so that we can use such indicators. The flaw of the method does not hinder much its usefulness.
Created b John F. Ehlers, the indicator seeks to transform the price into a normal Gaussian (normal) distribution. This is very helpful in detecting reversals.
The modified Fisher Transform basically includes highs and lows in its calculation. That’s the main difference between the original version and the modified version.
The Indigo indicator calculates a 21-period modified Fisher transform, then calculates a 200-period simple moving average on the market price for filtering.
The Indigo indicator is therefore used as follows:
A bullish signal is generated whenever the indicator surpasses -3.618 after having been below it. Simultaneously, the market must be above its 200-period simple moving average.
A bearish signal is generated whenever the indicator breaks 3.618 after having been above it. Simultaneously, the market must be below its 200-period simple moving average.
For simplicity, the indicators of the Rainbow collection are charted in an overlay arrow-based technique where only confirmed signals are shown (as opposed to showing the indicator on its own).
Coding the Indigo Indicator
Pine Script is TradingView’s main coding language which is very user-friendly. We will code this indicator and check out its signals. The next Figure shows the Nifty50 with the signals generated from the indicator.
//@version=5
indicator(title = "Rainbow Collection - Indigo", format = format.price, precision = 2, overlay = true)
lookback = input(defval = 21, title = 'Lookback')
fisher = 0.0
norm_nominator = (close - ta.lowest(low, lookback))
norm_denominator = (ta.highest(high, lookback) - ta.lowest(low, lookback))
norm = norm_nominator / norm_denominator
norm_transformed = (norm * 2) - 1
fisher := 0.5 * math.log((1 + norm_transformed) / (1 - norm_transformed)) + .5 * nz(fisher[1])
buy = fisher > -3.618 and fisher[1] < -3.618 and close > ta.sma(close, 200)
sell = fisher < 3.618 and fisher[1] > 3.618 and close < ta.sma(close, 200)
plotshape(buy, style = shape.triangleup, color = color.rgb(75, 0, 130), location = location.belowbar, size = size.small)
plotshape(sell, style = shape.triangledown, color = color.rgb(75, 0, 130), location = location.abovebar, size = size.small)
The next Figure shows another signal chart on USDCAD.
If you want to see how to create all sorts of algorithms yourself, feel free to check out Lumiwealth. From algorithmic trading to blockchain and machine learning, they have hands-on detailed courses that I highly recommend.
Learn Algorithmic Trading with Python Lumiwealth
Learn how to create your own trading algorithms for stocks, options, crypto and more from the experts at Lumiwealth. Click to learn more
Summary
To sum up, what I am trying to do is to simply contribute to the world of objective technical analysis which is promoting more transparent techniques and strategies that need to be back-tested before being implemented. This way, technical analysis will get rid of the bad reputation of being subjective and scientifically unfounded.
I recommend you always follow the the below steps whenever you come across a trading technique or strategy:
Have a critical mindset and get rid of any emotions.
Back-test it using real life simulation and conditions.
If you find potential, try optimizing it and running a forward test.
Always include transaction costs and any slippage simulation in your tests.
Always include risk management and position sizing in your tests.
Finally, even after making sure of the above, stay careful and monitor the strategy because market dynamics may shift and make the strategy unprofitable.