OPEN-SOURCE SCRIPT

Uptrick: Smart Boundaries

This script is designed to help traders identify potential turning points in the market by combining RSI (Relative Strength Index) signals and Bollinger Bands. It also includes a built-in mechanism to manage the number of consecutive buy and sell entries, often referred to as pyramiding. Below you will find a detailed explanation of how the script works, how it was designed, and some suggestions on using it effectively in your trading workflow.

Overview

The script calculates RSI using a user-defined length and identifies when the RSI is in overbought or oversold territory based on user-selected threshold levels (default values for RSI overbought and oversold are 70 and 30, respectively). Additionally, it plots Bollinger Bands, which can provide context on potential price volatility. A Bollinger Band uses a moving average of the closing price plus and minus a configurable multiplier of the standard deviation. When price closes below the lower band, it may suggest a temporary oversold condition. Conversely, when price closes above the upper band, it may suggest an overbought condition.

Combining RSI and Bollinger Bands

The buy condition is triggered when the RSI is below the defined oversold level and the closing price is below the lower Bollinger Band. The idea behind this is that both momentum (as indicated by RSI) and volatility (as indicated by Bollinger Bands) are pointing to a potential undervaluation of price. The sell condition is the mirror image of that logic: it is triggered when the RSI is above the defined overbought level and the closing price is above the upper Bollinger Band. These signals aim to highlight points in the market where there could be a momentum shift or a mean reversion.

Pyramiding Logic

A unique aspect of this script is how it manages pyramiding, which is the practice of taking multiple entries in the same direction. For example, if you already have a buy entry and the conditions remain bullish, you might want to add an additional position. However, controlling how often you add those positions can be crucial in risk management. The script includes a variable that counts the number of buys and sells currently triggered. Once the maximum allowed number of entries per side (defined as maxPyramiding) is reached, no more entries of that type are plotted.

There is an optional feature (enablePyramiding) that allows you to reduce pyramiding by disabling it if you prefer to take only one entry per signal. When disabled, the script will not allow additional positions in the same direction until a reset occurs, which happens when the condition for that side is not met.

Labels and Visuals

Every time a buy or sell condition is triggered, the script plots a small label on the chart at the bar index. A buy label appears underneath the price to visually mark the entry, while a sell label appears above the price. These labels make it easy to see on the chart exactly when both conditions coincide (RSI condition and Bollinger Band condition). This visual reference helps traders quickly spot patterns and potential entry or exit points.

Alongside these signals, you can also see the Bollinger Bands plotted in real time. The upper band is shown in red, and the lower band is shown in green. Having these bands on the chart allows you to see when price is trading near the extremes of its recent average range.

Alerts

Alerts can be set to notify you when a buy or sell condition appears. This means that even if you are not actively watching the chart, you can receive a notification (through TradingView's alert system) whenever RSI crosses into oversold or overbought territory in conjunction with price closing outside the Bollinger Bands.

Potential Uses

Traders might use this tool for a range of styles, from scalping to swing trading. Since the signals are based on RSI and Bollinger Bands, it can help highlight points of possible mean reversion, but it does not guarantee future performance. It may be beneficial to combine it with other forms of technical analysis, such as volume studies or support/resistance levels, to help filter out weaker signals.

Customization

One of the main strengths of this script is its flexibility. All key parameters can be tuned to fit your personal trading style and risk tolerance. You can adjust:

• The RSI length and threshold levels for overbought/oversold.
• Bollinger Band length and multiplier to catch wider or narrower volatility bands.
• The maximum allowed pyramiding entries per side.
• Whether to enable or disable pyramiding logic altogether.

Uniqueness of This Script

A distinctive aspect of this script is its combination of a classic momentum indicator (RSI) with Bollinger Bands, plus an intelligent pyramiding component. While many indicators simply plot RSI or Bollinger Bands, this script synchronizes the two to highlight oversold and overbought conditions more precisely. At the same time, the built-in pyramiding counter allows you to manage how many times you enter on the same signal direction, giving you a dynamic scaling feature not commonly seen in standalone RSI or Bollinger Band scripts. This approach helps traders maintain consistent risk management by preventing excessive stacking of positions when signals continue to appear, which can be beneficial for those who like to scale into trades gradually. All these factors contribute to the script's uniqueness and potential usefulness for a wide range of trading styles, from cautious single-entry traders to those who prefer incremental position building.

Conclusion

This script is a helpful tool for traders interested in combining momentum and volatility indicators. By integrating RSI signals with Bollinger Band breakouts, it tries to uncover moments when price might be at an extreme. It further offers pyramiding control, which can be appealing to traders who like to scale into positions. As with any technical indicator or script, it is important to do additional research and not rely solely on these signals. Always consider using proper risk management, and keep in mind that no tool can accurately predict future prices every time.


BACKTESTED RESULTS

The script has proven to be the most profitable on the 3 mins timeframe with these settings:

RSI Length: 17
Overbought Level: 70
Oversold Level: 33
Bollinger Bands Length: 19
Bollinger Bands Multiplier: 2

As of 22nd December 2024
Pyramiding was set to 10
Not financial advice

TOTAL WINNING RATE: 75.04%




Bollinger Bands (BB)Relative Strength Index (RSI)Volatility

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


✨ Exclusive indicators and "protected indicators" codes on Discord for free!

📲 Discord: discord.gg/Def47ueyuD
גם על:

כתב ויתור