Rainbow Oscillator

The Rainbow Oscillator is a technical indicator that shows prices in overbought or oversold areas. That allows you to catch the price reversal point.


.:: Dynamic levels ::.
The indicator levels are divided into several zones, which have a fibonacci ratio. Zones determine the overbought/oversold level. Blue and green level zones are better for buying, red and orange for selling. Dynamic levels are used as replacements for classic levels such as -100 and 100 for the CCI indicator or 30 and 70 for the RSI indicator. Dynamic levels work much better than static levels, as they are more adaptive to the current market situation.

.:: Composite oscillator (3 in 1) ::.
The main signal line of the indicator includes all three oscillators RSI , CCI , Stoch in different ratios. In the settings, you can change the proportions or completely remove one of the oscillators by setting its weight to 0

.:: CCI + RSI + Stoch ratio setting ::.
Each of the oscillators has its own weight in the calculation formula: w2 * cci ( + w1 * ( rsi - 50) + (1 - w2 - w1) * ( stoch - 50), this allows you to create the resulting oscillator from all indicators, depending on the weight of each of them. Each weight value must be between 0 and 1 so that the sum of all weights does not exceed 1.

.:: Smoothing levels and lines of the oscillator ::.
Smoothing the oscillator readings allows you to filter out the noise and get more accurate data. Level offset allows you to customize the support for inputs.

.:: Market Flat ::.
Dynamic creation of levels allows you to find in the price reversal zone, even when the price is in a flat

.:: Sources ::.
You can change the data source for the indicator to the number of longs and shorts for the selected asset. For example, BTCUSDLONGS / BTCUSDSHORTS is perfect for Bitcoin , then the oscillator will work on this data and will not use the quote price.

.:: Trend Detection ::.
The main line of the oscillator has 2 colors - green and red. Red means downtrend, green means uptrend. Trend reversal points are most often found in overbought and oversold zones.

.:: Alerts ::.
Alerts inside for next events: Buy (blue point) Sell (red point) and TrendReversal (change line color)

There are several possible entry points for the indicator, let's consider them all.

1) Trend reversal.
Long entry: The indicator line is in the green zone below 0 (oversold), while the line changes color from red (downward) to green (upward)

Short entry: The indicator line is in the red zone above the 0 (overbought) mark, while the line changes color from green to red.

2) Red and blue dots.
Long entry: Blue dot
Short Entry: Red Dot

I prefer to use the first trading method.


.:: Trend Filter (checkbox) ::.
Use trend confirmation for red/blue dots. When enabled, the blue dot requires an uptrend, red dot requires downtrend confirmation before appearing.

.:: Use long/shorts (checkbox) ::.
Change formula to use longs and shorts positions as data source (instead of quote price)

.:: RSI weight / CCI weight / Stoch weight ::.
Weight control coefficients for RSI and CCI indicators, respectively. When you set RSI Weight = 0, equalize the combo of CCI and Stoch , when RSI Weight is zero and CCI Weight is equal to the oscillator value will be plotted
only from Stoch . Intermediate values ​​have a high degree of measurement of each of the three oscillators in percentage terms from 0 to 100. The calculation uses the formula: w2 * cci ( + w1 * ( rsi - 50) + (1 - w2 - w1) * ( stoch - 50),
where w1 is RSI Weight and w2 is CCI Weight, Stoch weight is calculated on the fly as (1 - w2 - w1), so the sum of w1 + w2 should not exceed 1, in this case Stoch will work as opposed to CCI and RSI .

.:: Oscillograph fast and slow periods ::.
The fast period is the period for the moving average used to smooth CCI , RSI and Stoch . The slow period is the same. The fast period must always be less than the slow period.

.:: Oscillograph samples period::.
The period of smoothing the total values of indicators - creates a fast and slow main lines of the oscillator.

.:: Oscillograph samples count::.
How many times smoothing applied to source data.

.:: Oscillator samples type ::.
Smoothing line type e.g. EMA , SMA , RMA …

.:: Level period ::.
Periodically moving averages used to form the levels (zone) of the Rainbow Oscillator indicator

.:: Level offset ::.
Additional setting for shifting levels from zero points. Can be useful for absorbing levels and filtering input signals. The default is 0.

.:: Level redundant ::.
It characterizes the severity of the state at each iteration of the level of the disease. If set to 1 - the levels will not decrease when the oscillator values ​​fall. If it has a value of 0.99 - the levels are reduced by 0.01
each has an oscillator in 1% of cases and is pressed to 0 by more aggressive ones.

.:: Level smooth samples ::.
setting allows you to set the number of strokes per level. Measuring the number of averages with the definition of the type of moving averages

.:: Level MA Type ::.
Type of moving average, average for the formation of a smoothing overbought and oversold zone

  • Stochastic period fix
  • Signal circles fix
  • Changed colors
  • Default settings renew
  • Added customized weight for stochastic
  • Added two lines, fast and slow
  • Added trend indicators
  • Added trend filtering
  • Renew long and short signals

  • Alerts added
  • On chain LONGS and SHORTS ratio added as oscillator source data, it's may be configured for any instrument, ETH, XRP and other...


TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。