ChartArt

Stochastic + RSI, Double Strategy (by ChartArt)

This strategy combines the classic RSI strategy to sell when the RSI increases over 70 (or to buy when it falls below 30), with the classic Stochastic Slow strategy to sell when the Stochastic oscillator exceeds the value of 80 (and to buy when this value is below 20).

This simple strategy only triggers when both the RSI and the Stochastic are together in a overbought or oversold condition. The one hour chart of the S&P 500             worked quite well recently with this double strategy.

By the way this strategy should not be confused with the 'Stochastic RSI', which measures the RSI only.

All trading involves high risk; past performance is not necessarily indicative of future results.
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
strategy("Stochastic + RSI, Double Strategy (by ChartArt)", shorttitle="CA_-_RSI_Stoch_Strat", overlay=true)

// ChartArt's Stochastic Slow + Relative Strength Index, Double Strategy
//
// Version 1.0
// Idea by ChartArt on October 23, 2015.
//
// This strategy combines the classic RSI
// strategy to sell when the RSI increases
// over 70 (or to buy when it falls below 30),
// with the classic Stochastic Slow strategy
// to sell when the Stochastic oscillator
// exceeds the value of 80 (and to buy when
// this value is below 20).
//
// This simple strategy only triggers when
// both the RSI and the Stochastic are together
// in overbought or oversold conditions.
//
// List of my work: 
// https://www.tradingview.com/u/ChartArt/


///////////// Stochastic Slow
Stochlength = input(14, minval=1, title="lookback length of Stochastic")
StochOverBought = input(80, title="Stochastic overbought condition")
StochOverSold = input(20, title="Stochastic oversold condition")
smoothK = input(3, title="smoothing of Stochastic %K ")
smoothD = input(3, title="moving average of Stochastic %K")
k = sma(stoch(close, high, low, Stochlength), smoothK)
d = sma(k, smoothD)

 
///////////// RSI 
RSIlength = input( 14, minval=1 , title="lookback length of RSI")
RSIOverBought = input( 70  , title="RSI overbought condition")
RSIOverSold = input( 30  , title="RSI oversold condition")
RSIprice = close
vrsi = rsi(RSIprice, RSIlength)


///////////// Double strategy: RSI strategy + Stochastic strategy

if (not na(k) and not na(d))
    if (crossover(k,d) and k < StochOverSold)
        if (not na(vrsi)) and (crossover(vrsi, RSIOverSold))
            strategy.entry("LONG", strategy.long, comment="StochLE + RsiLE")
 
 
if (crossunder(k,d) and k > StochOverBought)
    if (crossunder(vrsi, RSIOverBought))
        strategy.entry("SHORT", strategy.short, comment="StochSE + RsiSE")
 
 
//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)
ChartArt
a year ago
There is a reason why I published this strategy with the default classic settings of both indicators (RSI strategy + Stochastic strategy). The combination of both indicators results in eight ! different parameters, which all need to be adjusted and backtested to further improve the trading results.

In my research it appears that changing the overbought and oversold condition of the Stochastic can lead to better results than changing the overbought and oversold conditions of the RSI.
Reply
Hello ChartArt,

Great work. I really liked this strategy. I would like to know if you have any plans of adding alerts in the future.
Reply
I just observed that it repaints :)
Reply
Mertz74 PRO rinku.singh.111
a year ago
repaints?
Reply
Vincent121 Mertz74
a year ago
not sure about this but I think it means that the script changes the buy and sell orders afterwards...
can anyone confirm?
Reply
rinku.singh.111 Vincent121
a year ago
Yes, it changes afterwards
Reply
ChartArt rinku.singh.111
11 months ago
This is pretty weird. I see no reason why it could repaint, because it doesn't use higher time-frames.

I assume what you mean is that it "repaints" after a candle has closed. Because signals are shown as soon a new candle is printed and if the new candle closes much higher or lower than it opened then it "repaints". But that is an issue which EVERY indicator on Tradingview has.

Strategies which actually repaint, because they use future information not available at the time of trading only in hindsight (because they use close prices of higher-time frames) are especially these two strategies:

GetTrendStrategy


ANN Strategy



And this strategy also repaints, but not as badly as the previous two:

Vdub FX Sniper VX3 / Strategy
Reply
Mertz74 PRO
a year ago
While i'm very new to understanding PineScript, in your explanation of the strategy it seems as if you state it will trigger a buy when both targets have been met RSI falls below 30 and STO gets a KD cross below 20. In your script it seems as if RSI has to cross back above 30 to signal a buy? Also curious as when i drop RSI 14 and STO 14-3-3 below the chart the buys and sells that appear as an overlay to the chart don't quite seem to follow the rules? What i mean by that is an example of the buys and sells that take place from 11/11/15 23:00 to 11/20/15 16:00 . There are times where STO is crossing in oversold territory but RSI>30 (not having been recently oversold) and a buy will occur. What am I missing. Any insight you can provide would be helpful, i've been fiddling with a very similar approach and am interested in what you are doing.
Reply
PietroGarosi
2 months ago
Looks good but unfinished, you just need to create an exit criteria and it works very nice.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out