RSI Swing Signal

This indicator is a tool designed to be used with Steven Hart's RSI Exhaustion strategy. For more information google TheTradingChannel or look him up on YouTube :)

The default RSI settings for this strategy are:

RSI Overbought: 80
RSI Oversold: 20
Length: 7

When the RSI gets above 80, the line will turn red and the script will begin looking for a specific type of engulfing candle to go short. The same is true when the RSI gets below 20, but the line will turn green and look for longs. It is best used as a back-testing aid, but it can also be used to send emails or SMS alerts whenever the conditions are met. It can also be used as an alternative colored RSI indicator by removing the signals in the settings menu and changing the RSI parameters to whatever you normally use. This can aid in RSI divergence and overbought/sold strategies.


The bright green and bright red lines represent the first type of engulfing candle.
The dark green and red lines represent the second type of engulfing candle.

Some pairs perform best with only one of these entries, while others work fine with both.

This is a counter-trend or consolidation strategy, and is best used in combination with trend-continuation or trend-following strategies. As always, make sure you back-test it before you use it to trade as it works better on some pairs than others.
Notes de version: Fixed script picking up some invalid engulfing candles.
Notes de version: Added alert functionality.
Notes de version: Added strategy back-testing results.
Notes de version: Here is a companion indicator I made for this oscillator which plots your entry, SL and TP to the chart:

Notes de version: Minor improvements.
Notes de version: Minor improvements
Notes de version: Minor improvements
Notes de version: Updated to Pine Script version 4
Script open-source

Dans le plus pur esprit de TradingView, l'auteur de ce texte l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur ! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par les règles internes. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?
My Resources Hub: https://theartoftrading.com
FREE YouTube Lessons: http://rebrand.ly/zyt
FREE Pine Script Basics Course: http://rebrand.ly/zpsbc
Pine Script MASTERY Course: http://rebrand.ly/zpsmc
My Indicators & Strategies: http://rebrand.ly/zmisc


any way to create alerts based on this?
+2 Répondre
@FlyAngler, Yes :) if you click the Add Alert button and select the script name (RSI Swing Signal) in the condition box, you will get alerts whenever a long or short signal is detected :) hope you enjoy using the script!
+1 Répondre
Hello do you have a list of pairs where it works better? thank you so much for sharing the indicator
+2 Répondre
Whoop-whoop, awesomeness, thanks for sharing this man 🙏

(I will look to convert to use it in the Strategy Tester
so I can optimize settings for different markets)
Amazing! Absolutely Amazing.
One of the best and great indicator on tradingview.....
use following setting for best result

Lookback : 7
RSI Overbought Level : 60
RSI Oversold Level : 30
RSI Length : 7
RSI Source : Close

How to backtest this strategy
ZenAndTheArtOfTrading indrajitkaman244
@indrajitkaman244, here's a youtube video I made explaining the backtesting process: https://youtu.be/W_EECZtRBE8
+3 Répondre
@ZenAndTheArtOfTrading so to turn this into a strategy this should work or am I missing something?

////////////////////////////LONG + SHORT FILTER//////////////////////////////////////////

// Make input option to configure trade direction
tradeDirection = input(title="Trade Direction", type=string,
options=, defval="Long")

// Translate input into trading conditions
longOK = (tradeDirection == "Long") or (tradeDirection == "Both")
shortOK = (tradeDirection == "Short") or (tradeDirection == "Both")

//////////////////////////////////////////// ENTRY AND EXIT ORDERS ///////////////////////////////////////////////

// Step 6) Submit entry orders
if ( buysignal1 and validLong and longOK)
strategy.entry(id="buysignal1", long=true, qty=longEntrySize)

if (buysignal2 and validLong and longOK)
strategy.entry(id="buysignal2", long=true, qty=longEntrySize)

if (sellsignal1 and validShort and shortOK )
strategy.entry(id="sellsignal1", long=false, qty=shortEntrySize)

if (sellsignal2 and validShort and shortOK)
strategy.entry(id="sellsignal2 ", long=false, qty=shortEntrySize)

// Step 7) Submit exit orders
if (strategy.position_size > 0)
strategy.exit(id="XL", from_entry="buysignal1", stop=tradeStopPrice, limit=tradeTargetPrice)

if (strategy.position_size > 0)
strategy.exit(id="XL", from_entry="buysignal2", stop=tradeStopPrice, limit=tradeTargetPrice)

if (strategy.position_size > 0)
strategy.exit(id="XL", from_entry="buysignal1", stop=tradeStopPrice, limit=tradeTargetPrice)

if (strategy.position_size > 0)
strategy.exit(id="XL", from_entry="buysignal2", stop=tradeStopPrice, limit=tradeTargetPrice)
RobertLC EDAV4394
Did it work?

Was going to try do that too...to use with the strategy tester.
So I can try optimize it on different markets.

Any luck yet?