//@version=3
strategy("Bollinger + RSI, Double Strategy Long-Only (by ChartArt) v1.2", shorttitle="CA_-_RSI_Bol_Strat_1.2", overlay=true)
// ChartArt's RSI + Bollinger Bands, Double Strategy UPDATE: Long-Only
//
// Version 1.2
// Idea by ChartArt on October 4, 2017.
//
// This strategy uses the RSI indicator
// together with the Bollinger Bands
// to buy when the price is below the
// lower Bollinger Band (and to close the
// long trade when this value is above
// the upper Bollinger band).
//
// This simple strategy only longs when
// both the RSI and the Bollinger Bands
// indicators are at the same time in
// a oversold condition.
//
// In this new version 1.2 the strategy was
// simplified by going long-only, which made
// it more successful in backtesting.
//
// List of my work:
// https://www.tradingview.com/u/ChartArt/
//
// __ __ ___ __ ___
// / ` |__| /\ |__) | /\ |__) |
// \__, | | /~~\ | \ | /~~\ | \ |
//
//
///////////// RSI
RSIlength = input(6,title="RSI Period Length")
RSIoverSold = 50
RSIoverBought = 50
price = close
vrsi = rsi(price, RSIlength)
///////////// Bollinger Bands
BBlength = input(200, minval=1,title="Bollinger Period Length")
BBmult = 2 // input(2.0, minval=0.001, maxval=50,title="Bollinger Bands Standard Deviation")
BBbasis = sma(price, BBlength)
BBdev = BBmult * stdev(price, BBlength)
BBupper = BBbasis + BBdev
BBlower = BBbasis - BBdev
source = close
buyEntry = crossover(source, BBlower)
sellEntry = crossunder(source, BBupper)
plot(BBbasis, color=aqua,title="Bollinger Bands SMA Basis Line")
p1 = plot(BBupper, color=silver,title="Bollinger Bands Upper Line")
p2 = plot(BBlower, color=silver,title="Bollinger Bands Lower Line")
fill(p1, p2)
///////////// Colors
switch1=input(true, title="Enable Bar Color?")
switch2=input(true, title="Enable Background Color?")
TrendColor = RSIoverBought and (price[1] > BBupper and price < BBupper) and BBbasis < BBbasis[1] ? red : RSIoverSold and (price[1] < BBlower and price > BBlower) and BBbasis > BBbasis[1] ? green : na
barcolor(switch1?TrendColor:na)
bgcolor(switch2?TrendColor:na,transp=50)
///////////// RSI + Bollinger Bands Strategy
long = (crossover(vrsi, RSIoverSold) and crossover(source, BBlower))
close_long = (crossunder(vrsi, RSIoverBought) and crossunder(source, BBupper))
if (not na(vrsi))
if long
strategy.entry("RSI_BB", strategy.long, stop=BBlower, oca_type=strategy.oca.cancel, comment="RSI_BB")
else
strategy.cancel(id="RSI_BB")
if close_long
strategy.close("RSI_BB")
//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)
Add to the bottom of your script:I'm not sure if it's possible to add some labels, (like the kind that are in the upper left) based on lower indicators, but I was wondering if it's possible. I was looking for something like a label to say "RSI>50" thats green and "RSI<50" Red, then maybe one another color that says rsi1>68 and rsi1<32. Then maybe another that says RSI1> RSI2 green, "RSI1<RSI2" red. then another one that saying RSI1>BBmidline green and RSI1<BBmidline red. maybe another saying BBmidline > or = 68 "reversal" red and BBmidline< or = 32 "reversal" green. I have some basic thinkscript abilities, so I may be able to finish it up if someone were able to point me in the right direction.
AddLabel(yes,
if rsi>68 then "rsi1>68" else
if rsi<32 then "rsi1<32" else
if RSI>50 then "RSI1>50" else
if RSI<50 then "RSI1<50" else " ",
if rsi>68 then color.cyan else
if rsi<32 then color.magenta else
if RSI>50 then color.green else
if RSI<50 then color. Red else color.light_gray);
AddLabel(yes,
if RSI>RSI2 then "RSI1> RSI2" else "RSI1<RSI2",
if RSI>RSI2 then color.green else color.red );
AddLabel(yes,
if RSI>midline then "RSI1>BBmidline" else "RSI1<BBmidline red",
if RSI>midline then color.green else color.red) ;
AddLabel(midline>= 68 or midline<= 32,
if midline>= 68 then "OB reversal" else
if midline<32 then "OS reversal" else " ",
if midline>= 68 then color.red else
if midline<32 then color.green else color.light_gray);
Can we have BUY/SELL arrow added to this chart? Also do we have a scanner base on those BUY/SELL signals?A double RSI indicator with standard deviation bands of the RSI. The very important RSI 50 line and coloring of the RSI lines for strength and weakness with a could to show when the two RSI lines separate. This would indicate a stronger move.
The Midline of the RSI bands works the same as the Market Mover with crossover of the RSI and Midline giving the signals.
The bands and 80 / 20 lines will show when RSI is very strong in one direction or the other. It can be traded the same as BBs by trading from top to bottom band and vice versa, that would be for the most adventurous trader.
The cross of the RSI and Midline would be the next step down in risk for a trade, while that same cross along with a cross of the 50 line would be the conservative trade entry or exit.
The RSI is not an oversold/overbought indicator, it is a strength indicator. So when RSI is high it is telling you the trend is strong, low shows trend is weak. So even when high and falling if it does not break the 50 line the up trend is most likely to continue. So always keep in mind the importance of the 50 line.
I will put up two versions one for scalping types which will match Market Mover signals (without scaling problems and zooming) and one for swing trading types.
Any feedback or questions are welcome.
Short term
Long term
Skeleton of RSI and SMA short term
View attachment 4999
Short term
https://tos.mx/N6WBa1
Long term
https://tos.mx/lpvzpv
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Ultimate RSI [LuxAlgo] for ThinkOrSwim | Indicators | 12 | ||
The Ultimate Buy and Sell Indicator for ThinkOrSwim | Indicators | 4 | ||
P | Ultimate MACD For ThinkOrSwim | Indicators | 16 | |
Ultimate Bullish Cross using Price Momentum and Volume For SwingTrading | Indicators | 26 | ||
YungTrader's Ultimate Indicator | Indicators | 685 |
Start a new thread and receive assistance from our community.
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.
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.