Relative Strength Index - Divergences - LibertusHello all,
To ease everyone's trading experience I made this script which colors RSI overbought and oversold conditions and as a bonus displays bullish or bearish divergences in last 50 candles (by default, you can change it).
Script is open source, part of code is from Trading View examples. If you have suggestions or you already made some improvements, please report in comment.
Happy trading and good luck!
Indeks Kekuatan Relatif / Relative Strength Index (RSI)
Cheat Code- Example 1; Short-Term; Follow the Trend BINANCE:BTCUSDT ; BINANCE:ETHUSDT ; BINANCE:FILUSDT ;
This strategy is simple and easy to read and takes advantage of conditional signs of trend reversals. It works best in 10-minute time frames for most large and mid-cap crypto. This code is a tutorial for creating a profitable yet easy strategy, and hopefully, it can be put to good use :)
5 Minute Scalping StrategyTaking entrys based on the 1 minute timeframe MACD
only taking longs when all emas are in the correct order and there is a bigger than usual MACD downtick and the RSI is above 51
only taking shorts when all emas are in the opposite order and there is a bigger than usual uptick on the MACD and the RSI is bellow 49
bigger than usual ticks are defined by bollinger bands around the Macd and the ticks have to be higher than 35 and lower than -10
you can change whatever setting you like to make the strategy more profitible. pls share when you find a more profitible setting than me
the stoploss doesnt work correct if it would be hit in the same candle you enter the trade. pls share when you have a solution for this
the stratagy is profitible when i backtested it for the last month, but i dont know how it will play out in the future, so you enter the signals at your own risk
RSI vs Longs/Shorts Margin Ratio Percentage RankThis indicator plots the RSI of the current token and the percentage rank, of the RSI, of the ratio of a long margined token to a short margined token.
By default it plots the RSI of the current token with a color based on percentage rank the RSI of BITFINEX:BTCUSDLONGS divided by BITFINEX:BTCUSDSHORTS, so the assumption is that you are using it on a BTC chart. While you can select any Tradingview symbol for your Long and Short tokens I don't think you will get meaningful results unless you select a long and short margined token that matches your chart symbol, such as BITFINEX:ETHUSDLONGS and BITFINEX:ETHUSDSHORTS if you're trading ETHUSD. Even using margined tokens the results may not be meaningful, if there is not enough trade volume in the token, or if they are being manipulated, so you must backtest everything.
The three plot options are:
• Colored RSI - RSI plotted with colors based on the Longs/Shorts ratio
• Background Color - White RSI plot with Longs/Shorts ratio as background color
• RSI + Ratio - White RSI with Longs/Shorts ratio plotted in color
The chart shows all three options on an hourly BITFINEX:SOLUSD chart with BITFINEX:SOLUSDSHORTS and BITFINEX:SOLUSDLONGS.
By default it also plots a short term moving average and it can also plot the raw ratio rather than the percentage rank if selected.
This script started out as "RSI vs BITFINEX BTC Longs/Shorts Margin Ratio Percentage Rank" by me. I was interested in the ratio of BITFINEX:BTCUSDLONGS to BITFINEX:BTCUSDSHORTS as a measure of market sentiment and how that sentiment would magnify RSI changes. The volatility of the BTCUSDLONGS : BTCUSDSHORTS ratio was too low to get a good read, using a percent rank of the RSI of the ratio made the results more visible. After a discussion with @jason5480 I saw how opening it up to all margined Long / Short pairs was the best way forward. Unfortunately the name no longer matched the script, so I had to publish a new script.
Customizable Non-Repainting HTF MACD MFI Scalper Bot Strategy v2Customizable Non-Repainting HTF MACD MFI Scalper Bot Strategy v2
This script was originally shared by Wunderbit as a free open source script for the community to work with. This is my second published iteration of this idea.
WHAT THIS SCRIPT DOES:
It is intended for use on an algorithmic bot trading platform but can be used for scalping and manual trading.
This strategy is based on the trend-following momentum indicator . It includes the Money Flow index as an additional point for entry.
This is a new and improved version geared for lower timeframes (15-5 minutes), but can be run on larger ones as well. I am testing it live as my high frequency trader.
HOW IT DOES IT:
It uses a combination of MACD and MFI indicators to create entry signals. Parameters for each indicator have been surfaced for user configurability.
Take profits are now trailing profits, and the stop loss is now fixed. Why? I found that the trailing stop loss with ATR in the previous version yields very good results for back tests but becomes very difficult to deploy live due to transaction fees. As you can see the average trade is a higher profit percentage than the previous version.
HOW IS MY VERSION ORIGINAL:
Now instead of using ATR stop loss, we have a fixed stop loss - counter intuitively to what some may believe this performs better in live trading scenarios since it gives the strategy room to move. I noticed that the ATR trailing stop was stopping out too fast and was eating away balance due to transaction fees.
The take profit on the other hand is now a trailing profit with a customizable deviation. This ensures that you can have a minimum profit you want to take in order to exit.
I have depracated the old ATR trailing stop as it became too confusing to have those as different options. I kept the old version for others that want to experiment with it. The source code still requires some cleanup, but its fully functional.
I added in a way to show RSI values and ATR values with a checkbox so that you can use the new an improved ATR Filter (and grab the right RSI values for the RSI filter). This will help to filter out times of very low volatility where we are unlikely to find a profitable trade. Use the "Show Data" checkbox to see what the values are on the indicator pane, then use those values to gauge what you want to filter out.
Both versions
Delayed Signals : The script has been refactored to use a time frame drop down. The higher time frame can be run on a faster chart (recommended on one minute chart for fastest signal confirmation and relay to algotrading platform.)
Repainting Issues : All indicators have been recoded to use the security function that checks to see if the current calculation is in realtime, if it is, then it uses the previous bar for calculation. If you are still experiencing repainting issues based on intended (or non intended use), please provide a report with screenshot and explanation so I can try to address.
Filtering : I have added to additional filters an ABOVE EMA Filter and a BELOW RSI Filter (both can be turned on and off)
Customizable Long and Close Messages : This allows someone to use the script for algorithmic trading without having to alter code. It also means you can use one indicator for all of your different alterts required for your bots.
HOW TO USE IT:
It is intended to be used in the 5-30 minute time frames, but you might be able to get a good configuration for higher time frames. I welcome feedback from other users on what they have found.
Find a pair with high volatility (example KUCOIN:ETH3LUSDT ) - I have found it works particularly well with 3L and 3S tokens for crypto. although it the limitation is that confrigurations I have found to work typically have low R/R ratio, but very high win rate and profit factor.
Ideally set one minute chart for bots, but you can use other charts for manual trading. The signal will be delayed by one bar but I have found configurations that still test well.
Select a time frame in configuration for your indicator calculations.
Select the strategy config for time frame (resolution). I like to use 5 and 15 minutes for scalping scenarios, but I am interested in hearing back from other community memebers.
Optimize your indicator without filters : customize your settings for MACD and MFI that are profitable with your chart and selected time frame calculation. Try different Take Profits (try about 2-5%) and stop loss (try about 5-8%). See if your back test is profitable and continue to optimize.
Use the Trend, RSI, ATR Filter to further refine your signals for entry. You will get less entries but you can increase your win ratio.
You can use the open and close messages for a platform integration, but I choose to set mine up on the destination platform and let the platform close it. With certain platforms you cannot be sure what your entry point actually was compared to Trading View due to slippage and timing, so I let the platform decide when it is actually profitable.
Limitations: this works rather well for short term, and does some good forward testing but back testing large data sets is a problem when switching from very small time frame to large time frame. For instance, finding a configuration that works on a one minute chart but then changing to a 1 hour chart means you lose some of your intra bar calclulations. There are some new features in pine script which might be able to address, this, but I have not had a chance to work on that issue.
Haydens RSI CompanionPreface: I'm just the bartender serving today's freshly blended concoction; I'd like to send a massive THANK YOU to all the coders and PineWizards for the locally-sourced ingredients. I am simply a code editor, not a code author. The book that inspired this indicator is a free download, plus all of the pieces I used were free code from the community; my hope is that any additional useful development of The Complete RSI is also offered open-source to the community for collaboration.
Features: Fibonacci retracement plus targets. Advanced dual data ticker. Heiken Ashi or bar overlay. Hayden, BarefootJoey, Tradingview, or Custom watermark of choice. Trend lines for spotting wedges, triangles, pennants, etc. Divergences for spotting potential reversals and Momentum Discrepancy Reversal Point opportunities. Percent change and price pivot labels with advanced data & retracement targets upon hover.
‼ IMPORTANT: Hover over labels for advanced information, like targets. Google & read John Hayden's "The Complete RSI" pdf book for comprehensive instructions before attempting to trade with this indicator. Always keep an eye on higher/stronger timeframes. See the companion oscillator here:
⚠ DISCLAIMER: DYOR. Not financial advice. Not a trading system. I am not affiliated with TradingView or John Hayden; this is my own personally PineScripted presentation of a suitable RSI chart companion to use when trading according to Hayden's rules.
About the Editor: I am a former-FINRA Registered Representative, inventor/patent-holder, and self-taught PineScripter. I mostly code on a v3 Pinescript level so expect heavy scripts that could use some shortening with modern conventions.
RSI vs BITFINEX BTC Longs/Shorts Margin Ratio Percentage RankThis indicator plots the RSI of the current token with a color based on percentage rank of the RSI of BITFINEX:BTCUSDLONGS divided by BITFINEX:BTCUSDSHORTS, with a plot of the moving average of the RSI. It can optionally plot the RSI in white and the ratio RSI in color, or the ratio as background color. It can also plot the raw ratio rather than the percentage rank if selected.
I was interested in the ratio of BITFINEX:BTCUSDLONGS to BITFINEX:BTCUSDSHORTS as a measure of market sentiment and how that sentiment would magnify RSI changes. The volatility of the BTCUSDLONGS : BTCUSDSHORTS ratio was too low to get a good read, using a percent rank of the RSI of the ratio made the results more visible.
This indicator should be used on a BTC chart.
RSI Scalping & Swing Signals With AlertsThis RSI indicator shows a green or red ribbon when the smoothed RSI is bullish or bearish. It also includes a long moving average for overall trend confirmation. Wait until the ribbon holds above or below the long moving average and take positions in that direction.
To get an easier to read RSI indicator, I smoothed the RSI out and paired it next to a short term RMA. These two together form the ribbon that will show you early reversals and trend direction. The long moving average is used as an overall trend detector and confirmation for longer term trends.
***HOW TO USE***
Scalping: Enter longs when the ribbon turns green and enter shorts when the ribbon turns red. Exit positions when the ribbon turns the opposite color or crosses the long moving average.
Swing Trading: When the ribbon holds above the long moving average or breaks out and retests it, look for long positions and exit when the ribbon turns red or crosses the long moving average. When the ribbon holds below the long moving average or breaks down and retests it, look for short positions and exit when the ribbon turns green or crosses the long moving average.
***DETAILS***
This indicator gives early reversal signals very well and waiting for the RSI ribbon to cross the long moving average helps to get you into positions when the market is ready to really move while filtering out some of the noise.
The ribbon and background will change to green or red depending on whether it is currently bullish or bearish.
There is also a label that changes colors and tells you if RSI is bullish or bearish and also whether the RSI ribbon is above or below the long moving average.
Green or red circles will appear on the indicator when there is a bullish or bearish cross of the RSI ribbon and the long moving average.
It also has alerts that trigger when RSI is turning bullish/bearish or when the RSI ribbon is crossing the long moving average.
***CUSTOMIZATION***
Each piece of this indicator can be customized to suit your preferences including the RSI source, length, smoothing length, short moving average length and long moving average length. You can also turn off the labels, signals and long moving average. All of these settings can be managed within the indicator settings input tab.
***MARKETS***
This indicator can be used as a signal on all markets, including stocks, crypto, futures and forex.
***TIMEFRAMES***
This RSI Scalping & Swing Signals indicator can be used on all timeframes.
***TIPS***
Try using numerous indicators of ours on your chart so you can instantly see the bullish or bearish trend of multiple indicators in real time without having to analyze the data. Some of our favorites are Trend Friend Scalp & Swing Trade Signals, Volume Spike Scanner, Buy & Sell Pressure Volume Profile, and Momentum Scalper in combination with this RSI indicator. They all have real time Bullish and Bearish labels as well so you can immediately understand each indicator's trend.
Double RSI FilterI've seen several youtubers using 2 RSI's on top of one another to filter trades for their strategies. I figured I would just code it up as an all-in-one indicator for people who have the basic package. This way they have an extra slot for another indicator if they need one and also for convenience.
Longs only when RSI 1 is above RSI 2 and shorts only when opposite. The arrows show where crosses of the RSI's occur.
Let me know if there is something else like this where it would just be very convenient to have 2 indicators on one window or other such things and I'll see if I can do something for you guys in my spare time. I'm just an amateur coder, but learning as I do more of these for people.
Thank you!
Hope this helps someone! :)
Floating RSI IndicatorThe Simple Floating Relative Index Strength Indicator to analysis the real time value of RSI along with High Minus Low of Day , Week and Monthly candle value and Real time Candle Body size. Simple indications of colors i.e. green indicates bullish and red indicates Bearish
Soren test 222Say we use strategy.risk.allow_entry_in() to only trade longs. When our script uses the strategy.entry() function to open a short trade, TradingView of course won’t allow our strategy to go short. But that doesn’t mean the trade is ignored. Instead the ‘enter short’ trade – which is actually a sell command – becomes an ‘exit long’ order.
Another way to think about this is the following. The strategy.entry() function can reverse positions: longs into shorts, and shorts into longs. That reverse behaviour gets stopped by strategy.risk.allow_entry_in(). What strategy.entry() instead ends doing is close positions: from long to flat, or from short to flat.
(The example strategies that we discuss later in this article show how strategy.risk.allow_entry_in() makes strategy.entry() close instead of open trades.)
# Can still trade both long or short
strategy.risk.allow_entry_in() can also allow our strategy to trade both long or short. That’s a bit silly, since this is already the default behaviour. But to cod
Double RSI For KateDouble RSI for scalping and trend recognition. Green for longs, red for shorts. Based on close. ;)
Ribbon Relative Strength IndexDescription
Ribbon RSI is the base on of the original RSI.
In RSI (dark color) and RSI-base MA (light color), we added short (12-day) and long (26-day) periods to show these crossovers, including crossovers between the RSI and the RSI-base MA, We've also added a trend period (50-day) RSI section that shows this section in the background.
And because Stochastic is a momentum indicator as well. It is therefore included as a guide to support RSI in another way.
How to Setting
— You can adjust the Short (12 days), Long (26 days) and Trend (50 days) periods from Settings: Input page in the RSI Setting section.
— You can adjust the RSI-base MA interval (9 days) on the Settings: Input page in the MA Setting section.
— You can display the lines of RSI, RSI-base MA at Setting: Style in RSI…
— You can display the Stochastic lines on the Settings: Style page in the Stochastic…
Multiple RSI Strategies [MoonKoder]In this script you can find multiple strategies to optimize your trading.
Here you have multiple RSI Strategies in only one indicator. The tool tips are self explenatory, so you don't have to worry to kon how to work with it.
I hope you enjoy it, and don't forget to like the script, so I can get supported to continue to work on more indicators. :)
Have fun :D
Trend & Momentum V2Declutter your charts. Simple indicator combining trend and momentum using Moving Average (currently default to 9-day EMA) and RSI (default length of 8). A long signal is generated when the price closes above the moving average and the moving average color turns red to green which indicated that the momentum measured using RSI is greater than 50. A short signal is generated when the price closes below the moving average and the moving average color turns green to red indicating RSI is below 50. Confirmation is done if there is no reversal on the next candle. For best results use multiple timeframe charts to trade on the right side of trend and momentum.
5 Symbol screener with triple MA and RSIBelow is a simple screener script fitted with 5 different symbols in the first column and in the other 4 columns the screener displays the respective moving averages and the RSI, the user has the ability to change between timeframes and different moving averages such as the SMA, EMA, RMA and WMA .
Weighted Relative Strength IndexWRSI uses 3 different user defined time frames with user defined weight on each time frame to give a final RSI value
Default values:
RSI 1 = 5 minute timeframe with a weightage of 9:14
RSI 2 = 15 minute timeframe with a weightage of 4:14
RSI 1 = 60 minute timeframe with a weightage of 1:14
Works best on a 15 min chart.
Please note this indicator will show exactly same values on all time frame charts so if you are looking at a daily chart you may want to change to 60 min, Daily & Weekly RSI time frame in settings.
The weights used here are basically sqaures of 1,2,& 3, you may choose any numbers that work for you.
The RSI length taken here is 27 (count of nakshatras)
The RSI MA length taken here is 28 (count of nakshatras + Abhijit Nakshatra)
You can obviously change it to what works best for you.
RSI MA CrossBuilding onto the standard RSI indicator, with the following modification and improvements:
- Added signals for RSI moving average crossovers, which usually indicator a bull or bear trend
- Added option to use smoothed RSI line
- Added alert for crossover signals
Enjoy~~~!
Custom Multi-Timeframe IndicatorIt's a pretty simple example of a nice custom screener you can run for multiple timeframes. This is an RSI screener, but you can easily change the function for your own Indicator.
Screener displays:
Last value of the instrument
RSI value for up to 10 instruments / 4 timeframes.
In Parameters you can change:
4 timeframes
10 instruments
Parameters for RSI
Styling parameters for table
If the selected timeframe will be lower than the current one you will receive a warning message in a table.
Thanks to @MUQWISHI to help me code it.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
Hayden's Advanced Relative Strength Index (RSI)Preface: I'm just the bartender serving today's freshly blended concoction; I'd like to send a massive THANK YOU to @iFuSiiOnzZ, @Koalafied_3, @LonesomeTheBlue, @LazyBear, @dgtrd and the rest of the PineWizards for the locally-sourced ingredients. I am simply a code editor, not a code author. The book that inspired this indicator is a free download, plus all of the pieces I used were free code from the PineWizards; my hope is that any additional useful development of The Complete RSI trading system also is offered open-source to the community for collaboration.
Features: Fixed & Custom price targeting. Triple trend state detection. Advanced data ticker. Candles, bars, or line RSI . Stochastic of over 20 indicators for adjustable entry/exit signals. Customizable trader watermark. Trend lines for spotting wedges , triangles, pennants , etc. Divergences for spotting potential reversals and Momentum Discrepancy Reversal Point opportunities. RSI percent change and price pivot labels. Gradient bar coloring on-chart.
‼ IMPORTANT: Hover over labels for additional information. Google & read John Hayden's "The Complete RSI" pdf book for comprehensive instructions before attempting to trade with this indicator. Always keep an eye on higher/stronger timeframes.
⚠ DISCLAIMER: DYOR. Not financial advice. Not a trading system. I am not affiliated with TradingView or John Hayden; this is my own personally PineScripted presentation of a suitable RSI to use when trading according to Hayden's rules.
About the Editor: I am a former-FINRA Registered Representative, inventor/patent-holder, and self-taught PineScripter. I mostly code on a v3 Pinescript level so expect heavy scripts that could use some shortening with modern conventions.
Hayden's RSI Rules:
📈 An Uptrend is indicated when:
1. RSI is in the 80 to 40 range
2. The chart shows simple bearish divergence
3. The chart shows Hidden bullish divergence
4. The chart shows Momentum Discrepancy Reversal Up
5. Upside targets being hit
6. 9-bar simple MA is greater than the 45-bar EMA on RSI
7. Counter-trend declines do not exceed 50% of the previous rally
🔮 An Uptrend is in danger when:
1. Longer timeframe fading rally
2. a) Multiple long-term bearish divergences. b) Upside targets not being hit.
3. 9-bar simple MA is less than the 45-bar EMA on RSI
4. Hidden bearish divergence, or simple bullish divergence
5. Deep counter-trend retracements greater than 50%
📉 A Downtrend is indicated when:
1. RSI is in the 60 to 20 range
2. The chart shows simple bullish divergences.
3. The chart shows Hidden bearish divergence
4. The chart shows Momentum Discrepancy Reversal Down
5. Downside targets being hit
6. 9-bar simple MA is less than the 45-bar EMA on RSI
7. Counter-trend rallies do not exceed 50% of the previous decline
🔮 A Downtrend is in danger when:
1. Longer timeframe fading decline
2. a) Multiple long-term bullish divergences. b) Downside targets not being hit.
3. 9-bar simple MA is greater than the 45-bar EMA on RSI
4. Hidden bullish divergence , or simple bearish divergence
5. Steep counter-trend retracements greater than 50%
Oversold RSI with tight SL Strategy (by Coinrule)This is one of the best strategies that can be used to get familiar with technical indicators and start to include them in your trading bot rules.
ENTRY
1. This trading system uses the RSI ( Relative Strength Index ) to anticipate good points to enter positions. RSI is a technical indicator frequently used in trading. It works by measuring the speed and change of price movements to determine whether a coin is oversold (indicating a good entry point) or overbought (indicating a point of exit/entry for a short position). The RSI oscillates between 0 and 100 and is traditionally considered overbought when over 70 and oversold when below 30.
2. To pick the right moment to buy, the strategy enters a trade when the RSI falls below 30 indicating the coin is oversold and primed for a trend reversal.
EXIT
The strategy then exits the position when the price appreciates 7% from the point of entry. The position also maintains a tight stop-loss and closes the position if the price depreciates 1% from the entry price. The idea behind this is to cut your losing trades fast and let your winners ride.
The best time frame for this strategy based on our backtesting data is the daily. Shorter time frames can also work well on certain coins, however in our experience, the daily works best. Feel free to experiment with this script and test it on a variety of your coins! With our backtesting data a trading fee of 0.1% is taken into account. The fee is aligned to the base fee applied on Binance, which is the largest cryptocurrency exchange by volume. In the example shown, this strategy made a handsome net profit of 39.31% on Chainlink with 61.54% of trades being profitable.
Optimised RSI strategy for Reversals (by Coinrule)The most common way to use the RSI to spot a good buy opportunity is to check for values lower than 30. Unfortunately, the RSI can remain in oversold territory for long periods, and that could leave you trapped in a trade in loss. It would be appropriate to wait for a confirmation of the trend reversal.
In the example above I use a short-term Moving Average (in this case, the MA9) coupled with an RSI lower than 40. This combination of events is relatively rare as reversal confirmations usually come when RSI values are already higher. As unusual as this setup is, it provides buy-opportunities with much higher chances of success.
The parameters of this strategy would be:
ENTRY: RSI lower than 40 and MA9 lower than the price
TAKE PROFIT and STOP-LOSS with a ratio of at least 2. That means that if you set up a take profit of 3%, your stop-loss shouldn’t be larger than 1.5%.
The advantage of this approach is that it has a high rate of success and allows you the flexibility of setting up the percentages of the take profit and stop-loss according to your preferences and risk appetite.
Divergence Macd+RSI Fast[RSU] -- No RepaintThis indicator combines the divergence of rsi and macd and displays it on the candlestick chart.
RSI:
1. When rsi is at a high point, once it falls by 1 k line, it will detect the divergence from the previous high point. This can quickly find the divergence that has taken effect and help you quickly capture the trend before a sharp decline or rise.
The difference between other RSI divergence indicators: the official divergence indicator is to detect the 5 and the k line, which may lead to a large amount of decline.
2. This indicator detects the previous high and the previous low of 5, 10, 20 lengths at the same time, instead of only detecting a fixed length, so that more deviations can be found.
MACD:
1. When MACD-diff line(orange color) is at a high point, once it falls by 1 k line, it will detect the divergence from the previous high point. This can quickly find the divergence that has taken effect and help you quickly capture the trend before a sharp decline or rise.
2. This indicator detects the previous high and the previous low of 5, 10, 20, 40 , 60 lengths at the same time, instead of only detecting a fixed length, so that more divergences can be found.
Notice:
Because it is a quick divergence detection, it is recommended to confirm that the divergence takes effect after the current k is completely closed first. I have identified this state in the indicator as "k not end".
Disadvantages and Risks:
Since it is a quick discovery, there will be error identification. Error divergences will recolor to grey.
Suggestion:
Use Alert catching divergence occurrences.
Please do not:
Don't go short in the uptrend, don't go long in the downtrend.
Top divergences that occur because of a strong uptrend are usually only temporary pullbacks. Bottom divergences in persistent declines are also temporary rallies. Do not attempt to trade such low-return trades.
It is recommended to use the divergence indicator when the stock price has made a new high and retraced, and once again made a new high, because this often leads to the end of the trend.
Divergence how to use:
1. After the previous candlestick was completely closed, a bottom divergence was found.
2. Open an long order at the beginning of the second bar, or as close to the bottom as possible (because the stop loss will be smaller).
3. Break the stop loss price below the previous low where the divergence occurred, which already means that the divergence is wrong.