[blackcat] L3 CCI-RSI Combo

CCI-RSI Combo indicator is a combination indicator that includes CCI and RSI. It uses some parameters to calculate the values of CCI and RSI, and generates corresponding charts based on these values. On the chart, when CCI exceeds 100 or falls below -100, yellow or magenta filling areas are displayed. Additionally, gradient colors are used on the RSI chart to represent different value ranges. Based on the values of CCI and RSI, buying or selling signals can be identified and "B" or "S" labels are displayed at the corresponding positions. It utilizes some technical indicators and logic to generate buying and selling signals, and displays the corresponding labels on the chart.

Here are the main parts of the code:

1. Definition of some variables:
- `N`, `M`, `N1`: Parameters used to calculate CCI and RSI.
- `xcn(cond, len)` and `xex(cond, len)`: Two functions used to calculate the number of times a condition is met.
2. Calculation of CCI (Commodity Channel Index):
- Calculate the CCI value based on the formula `(TYP - ta.sma(TYP, M)) / (0.015 * ta.stdev(TYP, M))`.
- Use the `plot()` function to plot CCI on the chart and set the color based on its value.
3. Calculation of RSI (Relative Strength Index):
- First calculate RSI1 by taking the average of positive differences between closing prices and the average of all absolute differences, and then multiplying by 100.
- Then use the ALMA function to transform RSI1 into a smoother curve.
- Use the `plot()` function to plot RSI on the chart and select gradient colors for shading based on its value.
4. Setting up the gradient color array:
- Create a color array using `array.new_color()` and add a series of color values to it.
5. Generating buying and selling signals based on conditions:
- Use logical operators and technical indicator functions to determine the conditions for buying and selling.
- Use the `` function to draw the corresponding labels on the chart to represent buying or selling signals.

Avoid losing contact!Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: 防止失联,请立即行动,加入本猫聊天群:

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。