# New Breed of Technical Indicators — Blue

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

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

The next Figure shows another signal chart on USDCAD.