New Breed of Technical Indicators — Blue

Discussing a New Technical Indicator and Coding it in TradingView

Sofien Kaabar, CFA
3 min readMay 27


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 Blue indicator, a contrarian method based on the concept of slopes.

The Fibonacci Trading Book is finally out! Filled with Fibonacci-based trading methods (tools, indicators, patterns, and strategies), this book will guide you through improving your trading and analysis by incorporating an important technical analysis approach that is Fibonacci [PDF Version available, see end of article).

Creating the Blue Indicator

The slope of a time series is the rate of change between the current values and previous values. A rising market will generally have a positive slope until it approaches zero and starts turning negative which coincides with a falling market.

The Blue indicator calculates the slope of the market from a number of periods in the past (by default 14 or 21) and then applies the RSI (by default 14 or 21) on the slope to have a bounded calculation that aim to tell when the slope is losing momentum.

The Blue indicator is used as follows:

  • A bullish signal is generated whenever the indicator surpasses 30 after having been below it.
  • A bearish signal is generated whenever the indicator breaks 70 after having been above it.

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 Blue 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.

Signal chart
// This source code is subject to the terms of the Mozilla Public License 2.0 at
// © Sofien-Kaabar
indicator("Rainbow Collection - Blue", overlay = true)
lookback = input(defval = 21, title = 'Lookback')
lookback_rsi = input(defval = 21, title = 'RSI Lookback')
slope = (close - close[lookback]) / lookback
indicator = ta.rsi(slope, lookback_rsi)
buy = indicator > 30 and indicator[1] < 30 and indicator < 35
sell = indicator < 70 and indicator[1] > 70 and indicator > 65
plotshape(buy, style = shape.triangleup, color =, location = location.belowbar, size = size.small)
plotshape(sell, style = shape.triangledown, color =, location = location.abovebar, size = size.small)

The next Figure shows another signal chart on USDCAD.

Signal chart

The PDF link for the Fibonacci Trading Book is the following (make sure to include your e-mail address in the notes part):

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.



Sofien Kaabar, CFA

Top writer in Finance, Investing, Business | Trader & Author

Recommended from Medium


See more recommendations