Bollinger Band Wick and SRSI Signals For ThinkOrSwim

rewardiaz

Member
VIP
Author states:
Introduction
This indicator uses a novel combination of Bollinger Bands, candle wicks crossing the upper and lower Bollinger Bands and baseline, and combines them with the Stochastic SRSI oscillator to provide early BUY and SELL signals in uptrends, downtrends, and in ranging price conditions.


How it’s unique
People generally understand Bollinger Bands and Keltner Channels. Buy at the bottom band, sell at the top band. However, because the bands themselves are not static, impulsive moves can render them useless. People also generally understand wicks. Candles with large wicks can represent a change in pattern, or volatile price movement. Combining those two to determine if price is reaching a pivot point is relatively novel. When Stochastic RSI (SRSI) filtering is also added, it becomes a genuinely unique combination that can be used to determine trade entries and exits.


What’s the benefit
The benefit of the indicator is that it can help potentially identify pivots WHEN THEY HAPPEN, and with potentially minimal retracement, depending on the trader’s time window. Many indicators wait for a trend to be established, or wait for a breakout to occur, or have to wait for some form of confirmation. In the interpretation used by this indicator, bands, wicks, and SRSI cycles provide both the signal and confirmation.

It takes into account 3 elements:

  1. Price approaching the upper or lower band or the baseline - MEANING: Price is becoming extended based on calculations that use the candle trading range.
  2. A candle wick of a defined proportion (e.g. wick is 1/2 the size of a full candle OR candle body) crosses a band or baseline, but the body does not cross the band or baseline - MEANING: Buyers and sellers are both very active.
  3. The Stochastic RSI reading is above 80 for SELL signals and below 20 for BUY signals - MEANING: Additional confirmation that price is becoming extended based on the current cyclic price pattern.

gWZ9Ggu.png


Hello Everyone,

I wonder if some can translate this code to TOS. But with the B/S signals only when the candle close outside either bands and the RSI is corresponding with either bands as well as Stochastic.

https://www.tradingview.com/script/cqTYgepJ-Bollinger-Band-Wick-and-SRSI-Signals-MW/cqTYgepJ

Very much appreciate the help
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Hello Everyone,

I wonder if some can translate this code to TOS. But with the B/S signals only when the candle close outside either bands and the RSI is corresponding with either bands as well as Stochastic.

https://www.tradingview.com/script/cqTYgepJ-Bollinger-Band-Wick-and-SRSI-Signals-MW/cqTYgepJ

Very much appreciate the help
check the below:

CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © MWRIGHT, INC
#// This indicator is was partially derived from the default TradingView Bollinger Bands Indicator
#// https://www.tradingview.com/chart/?solution=43000501840
#indicator(shorttitle="BB Wicks SRSI [MW]", title="Bollinger Band Wick and SRSI Signals [MW]", overlay=true, max_labels_count = 500)
# Converted by Sam4Cok@Samer800    - 06/2024

input showSignals = yes;     # "Show Bollinger Band Signals",
input hideBaselineSignals = yes; # "Hide Baseline Signals"
input showWickCloud       = yes; # "Show Wick Signals"
#// Bollinger Band Settings
input bbLength  = 21;     # "Period length for Bollinger Band Basis"
input basisMovAvgType  = AverageType.SIMPLE; # "Basis MA Type"
input Source   = close; #, title="Source"
input stdvMultiplier = 2.5; # "Standard Deviation Multiplier"
input offset = 0;
#// Wick Settings for Bollinger Bands
input wickPeriods = 14; #  // Length for averaging
input WickRatioForBands = 0.3;     # "Wick Ratio for Bands"
input WickRatioForBaseline  = 0.3; # "Wick Ratio for Baseline"
#// Wick Settings for Candle Signals
input upperWickThreshold    = 50; # "Upper Wick Threshold"
input lowerWickThreshold    = 50; # "Lower Wick Threshold"
input useCandleBody         = no; # "Use Candle Body (rather than full candle Size)"
#// Visual Preferences
input ShowBollingerBand = yes; # "Show Bollinger Bands"
#// Stochastic RSI
input UseStochasticRsiFiltering = yes; # "Use Stochastic RSI Filtering"
input smoothKLength     = 3;          # "K",
input rsiLength   = 14;               # "RSI Length"
input StochasticLength = 8;           # "Stochastic Length"

def na = Double.NaN;

# stoch(source, high, low, length) =>
script stoch {
    input src = close;
    input h = high;
    input l = low;
    input len = 14;
    def hh = Highest(h, len);
    def ll = Lowest(l, len);
    def c1 = src - ll;
    def c2 = hh - ll;
    def stoch = if c2 != 0 then c1 / c2 * 100 else 0;
    plot return = stoch;
}
script rising {
    input src = close;
    input len = 5;
    def result = if len == 1 then src > src[1] else
                  fold i = 0 to len -1 with p = no while src[i] > GetValue(src, i + 1) do
                  GetValue(src, i + 1) > GetValue(src, i + 2);
    plot out = result;
}
script falling {
    input src = close;
    input len = 5;
    def result = if len == 1 then src < src[1] else
                  fold i = 0 to len -1 with p = no while src[i] < GetValue(src, i + 1) do
                  GetValue(src, i + 1) < GetValue(src, i + 2);
    plot out = result;
}
#// Stochastic RSI values on the primary timeline
def _rsi0 = RSI(Price = Source, Length = rsiLength);
def _k0 = Average(stoch(_rsi0, _rsi0, _rsi0, StochasticLength), smoothKLength);
#getWickSignals(_len) =>
# // Calculate wick sizes
def upperWickSize = high - Max(open, close);
def lowerWickSize = Min(open, close) - low;
#// Calculate candle body size
def bodySize = AbsValue(close - open);
#// Calculate total candle range
def candleSize = high - low;
#// Determine relative wick size (as a percentage of total range)
def upperWickPercent = if candleSize != 0 then upperWickSize / candleSize * 100 else 0;
def lowerWickPercent = if candleSize != 0 then lowerWickSize / candleSize * 100 else 0;
#// Average body size for comparison
def avgBodySize = Average(bodySize, wickPeriods);
def bearishWick = upperWickPercent > upperWickThreshold and bodySize < avgBodySize;
def bullishWick = lowerWickPercent > lowerWickThreshold and bodySize < avgBodySize;
#// INITIALIZATIONS
def basis = MovingAverage(basisMovAvgType, Source[-offset], bbLength);
def dev = stdvMultiplier * StDev(Source[-offset], bbLength);
def upper = basis + dev;
def lower = basis - dev;
#// LOGIC
#// Calculate Signal
def closeBelowWickAbove = close < upper and high > upper;
def closeAboveWickBelow = close > lower and low < lower;
def size = if useCandleBody then bodySize else candleSize;
def upperWickRatio = upperWickSize / size;
def lowerWickRatio = lowerWickSize / size;
def bigUpperWick = upperWickRatio > WickRatioForBands; # ? true : false
def bigLowerWick = lowerWickRatio > WickRatioForBands; # ? true : false
def bigUpperWickMid = upperWickRatio > WickRatioForBaseline; # ? true : false
def bigLowerWickMid = lowerWickRatio > WickRatioForBaseline; # ? true : false

def wickedUpperBand; # = false
def wickedLowerBand; # = false
def wickedAboveBasis; # = false
def wickedBelowBasis; # = false

if UseStochasticRsiFiltering {
    wickedUpperBand = closeBelowWickAbove and bigUpperWick and low >= basis and _k0[1] > 80;
    wickedLowerBand = closeAboveWickBelow and bigLowerWick and high <= basis and _k0[1] < 20;
    wickedAboveBasis = bigUpperWickMid and close <= basis and high >= basis and falling(basis, 5) and _k0[1] > 80;
    wickedBelowBasis = bigLowerWickMid and close >= basis and low <= basis and rising(basis, 5) and _k0[1] < 20;
} else {
    wickedUpperBand = closeBelowWickAbove and bigUpperWick and low >= basis;
    wickedLowerBand = closeAboveWickBelow and bigLowerWick and high <= basis;
    wickedAboveBasis = bigUpperWickMid and close <= basis and high >= basis and falling(basis, 5);
    wickedBelowBasis = bigLowerWickMid and close >= basis and low <= basis and rising(basis, 5);
}
#// STATE MANAGEMENT FOR CANDLE WICKS
def signalBull = bullishWick;
def signalBear = bearishWick;
def bullState; # = false
def bearState; # = false

if signalBull {
    bullState = yes;
    bearState = no;
} else if bullState[1] and low < low[1] and !signalBull {
    bullState = no;
    bearState = bearState[1];
} else if signalBear {
    bullState = no;
    bearState = yes;
} else if bearState[1] and high > high[1] and !signalBear {
    bullState = bullState[1];
    bearState = no;
} else {
    bullState = bullState[1];
    bearState = bearState[1];

}

AddChartBubble(wickedUpperBand and showSignals, high, "S", Color.RED);
AddChartBubble(wickedLowerBand and showSignals, low, "B", Color.GREEN, no);

AddChartBubble(wickedAboveBasis and showSignals and !hideBaselineSignals, high, "S1", Color.DARK_RED);
AddChartBubble(wickedBelowBasis and showSignals and !hideBaselineSignals, low, "B1", Color.DARK_GREEN, no);

# // Plotting
plot baseLine = if ShowBollingerBand then basis else na; #, "Basis"
def p1 = if ShowBollingerBand then upper else na; #, "Upper"
def p2 = if ShowBollingerBand then lower else na; #, "Lower"
AddCloud(p1, p2, Color.DARK_GRAY, Color.DARK_GRAY, yes); #title = "Background"

def TrendDn = if bearState and showWickCloud then high + ATR(14) else na; #, color=color.red, style=plot.style_linebr, linewidth=2)
def TrendUp = if bullState and showWickCloud then low - ATR(14) else na; #, color=color.green, style=plot.style_linebr, linewidth=2)

AddCloud(TrendDn, ohlc4, Color.DARK_RED);
AddCloud(ohlc4, TrendUp, Color.DARK_GREEN);

#-- END of CODE
 
I'd like to start by thanking you. Do you think you could help me replace the filtering by RSI with this other study?

https://usethinkscript.com/threads/advanced_stochastic.18749/

I think it's a straightforward strategy involving RSI crossing Stochastic when it is in oversold or overbought territory. I also find it intriguing when the candle closes above the Bollinger Bands, RSI is above 70, and Stochastic is also above 70. There is a high probability that a reversal and the opposite is also true.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
362 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top