Simple_RSI+PA+DCA StrategyThis strategy is a result of a study to understand better the workings of functions, for loops and the use of lines to visualize price levels. The strategy is a complete rewrite of the older RSI+PA+DCA Strategy with the goal to make it dynamic and to simplify the strategy settings to the bare minimum.
In case you are not familiar with the older RSI+PA+DCA Strategy, here is a short explanation of the idea behind the strategy:
The idea behind the strategy based on an RSI strategy of buying low. A position is entered when the RSI and moving average conditions are met. The position is closed when it reaches a specified take profit percentage. As soon as the first the position is opened multiple PA (price average) layers are setup based on a specified percentage of price drop. When the price hits the layer another position with the same position size is is opened. This causes the average cost price (the white line) to decrease. If the price drops more, another position is opened with another price average decrease as result. When the price starts rising again the different positions are separately closed when each reaches the specified take profit. The positions can be re-opened when the price drops again. And so on. When the price rises more and crosses over the average price and reached the specified Stop level (the red line) on top of it, it closes all the positions at once and cancels all orders. From that moment on it waits for another price dip before it opens a new position.
This is the old RSI+PA+DCA Strategy:
The reason to completely rewrite the code for this strategy is to create a more automated, adaptable and dynamic system. The old version is static and because of the linear use of code the amount of DCA levels were fixed to max 6 layers. If you want to add more DCA layers you manually need to change the script and add extra code. The big difference in the new version is that you can specify the amount of DCA layers in the strategy settings. The use of 'for loops' in the code gives the possibility to make this very dynamic and adaptable.
The RSI code is adapted, just like the old version, from the RSI Strategy - Buy The Dips by Coinrule and is used for study purpose. Any other low/dip finding indicator can be used as well
The distance between the DCA layers are calculated exponentially in a function. In the settings you can define the exponential scale to create the distance between the layers. The bigger the scale the bigger the distance. This calculation is not working perfectly yet and needs way more experimentation. Feel free to leave a comment if you have a better idea about this.
The idea behind generating DCA layers with a 'for loop' is inspired by the Backtesting 3commas DCA Bot v2 by rouxam .
The ideas for creating a dynamic position count and for opening and closing different positions separately based on a specified take profit are taken from the Simple_Pyramiding strategy I wrote previously.
This code is a result of a study and not intended for use as a full functioning strategy. To make the code understandable for users that are not so much introduced into pine script (like myself), every step in the code is commented to explain what it does. Hopefully it helps.
Enjoy!
Relative Strength Index (RSI)
Negroni MA & RSI Strategy, plus trade entry and SL/TP optionsI will start with the context, and some things to think about when using a strategy tool to back-test ideas.
CONTEXT
FIRST: This is derived from other people's work, but I honestly hadn't found a mixed indicator MA strategy tool that does what this now does. If it is out there, apologies!!
This tool can help back-test various MA trends (SMA, EMA, HMA, VWMA); as well as factoring in RSI levels (or not); and can factor in a fixed HTF MA (or not). You can apply a 'retest entry' or a 'breakout entry', and you can also apply various risk mgt for SL/TP orders: 1) No SL/TP; or 2) a fixed %, or 3) dynamic ATR multipliers.
Find below, some details explaining what this tool is attempting to do.
Thank you, tack, salute!
THINGS TO REVIEW (it is not just about 'profitability'!!)
Whilst discretion is always highly encouraged as a trader, and a 100% indicator-driven strategy is VERY unlikely to yield sustainable results going forward, at the very least back-testing your strategies can help provide some guidance, not just on win rate Vs profit factor, but other things including:
a) Trade frequency: if a strategy has an 75% win rate and profit factor of 4, with all your parameters and confluence checks, but only triggers 3 trades every 5 years, is that realistically implementable to your trading situation if you have a $10,000 account?
b) Trade entry type: is it consistently better to wait for a retest of an 'MA zone', or is it better to market buy/sell on breakout of the 'MA zone'?
c) Risk management (SL/TP): is it consistently better to have a fixed static % for SL/TP ("I always place my stops 2% away, whether it is EURUSD or BTCUSDT"), or would you be better placed to try using an ATR multiplier of the respective assets?
d) Moving average type: is your old faithful 100 EMA really serving you well, or is the classic SMA more reliable, or how about the HMA, or the VWMA? Is the 100/200 cross holding up, or do you need something more sensitive? Is there any significant difference between a 10 EMA/20 EMA trend zone compared to a 13 EMA /25 EMA zone?
e) Confluence: Do added confluence checks (RSI, higher timeframe MA) actually improve profitability? But even if they do, is at the cost of cutting too many trades?
INPUTS AND PARAMETERS
Choice 1) Entry Strategy: Retest or Breakout - You can select both!
[ ]:
a) RETEST entry strat: price crosses UNDER FastMA INTO the 'MA trend zone'.
b) BREAKOUT entry strat: price crosses OVER FastMA OUT the 'MA trend zone'.
Choice 2) Risk Management (SL and TP) - You can select more than 1 strategy!
a) No SL/TP: Long trades are closed when the LOW crosses back UNDER the fastMA again, and shorts are closed when the HIGH crosses back OVER the fastMA again.
b) Static % SL/TP: Your SL/TP will be a fixed % away from avg. position price... WARNING: You should change this for various asset classes; FX vol is not the same as crypto altcoin vol!
c) Dynamic ATR SL/TP: Your SL/TP is a multiple of your selected ATR range (default is 50, see 'info' when you select ATR range). ATR accounts for the change in vol of different asset classes somewhat, HOWEVER... you should probably still not have the same multiplier trading S&P500 as you would trading crypto altcoins!
Then select your preferred parameters: EMA, SMA, HMA, VWMA, etc. You can mix and match, and most options have a info/tooltip guide.
RSI note: If you don't care for RSI levels, then set buy signal at 1... i.e always buys! Similarly set sell signal at 99.
ATR note: standard ATR length is usually 14, however... your SL/TP will move POST entry, and can tighten or widen your initial SL/TP... for better AND usually for worse! Go find a trade (strat 3) on the chart, look at the SL/TP lines, now change the number to 5, you'll see.
Fixed HTF MA note: If you don't care for HTF MA confluence, just change the timeframe/options to match the 'Slow MA' options you've chosen.
Rsi strategy for BTC with (Rsi SPX)
I hope this strategy is just an idea and a starting point, I use the correlation of the Sp500 with the Btc, this does not mean that this correlation will exist forever!. I love Trading view and I'm learning to program, I find correlations very interesting and here is a simple strategy.
This is a trading strategy script written in Pine Script language for use in TradingView. Here is a brief overview of the strategy:
The script uses the RSI (Relative Strength Index) technical indicator with a period of 14 on two securities: the S&P 500 (SPX) and the symbol corresponding to the current chart (presumably Bitcoin, based on the variable name "Btc_1h_fixed"). The RSI is plotted on the chart for both securities.
The script then sets up two trading conditions using the RSI values:
A long entry condition: when the RSI for the current symbol crosses above the RSI for the S&P 500, a long trade is opened using the "strategy.entry" function.
A short entry condition: when the RSI for the current symbol crosses below the RSI for the S&P 500, a short trade is opened using the "strategy.entry" function.
The script also includes a take profit input parameter that allows the user to set a percentage profit target for closing the trade. The take profit is set using the "strategy.exit" function.
Overall, the strategy aims to take advantage of divergences in RSI values between the current symbol and the S&P 500 by opening long or short trades accordingly. The take profit parameter allows the user to set a specific profit target for each trade. However, the script does not include any stop loss or risk management features, which should be considered when implementing the strategy in a real trading scenario.
Super 6x: RSI, MACD, Stoch, Loxxer, CCI, & Velocity [Loxx]Super 6x: RSI , MACD , Stoch , Loxxer, CCI , & Velocity is a combination of 6 indicators into one histogram. This includes the option to allow repainting.
What is MACD?
Moving average convergence divergence ( MACD ) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period exponential moving average ( EMA ) from the 12-period EMA .
What is CCI?
The Commodity Channel Index ( CCI ) measures the current price level relative to an average price level over a given period of time. CCI is relatively high when prices are far above their average. CCI is relatively low when prices are far below their average. Using this method, CCI can be used to identify overbought and oversold levels.
What is RSI?
The relative strength index is a technical indicator used in the analysis of financial markets. It is intended to chart the current and historical strength or weakness of a stock or market based on the closing prices of a recent trading period. The indicator should not be confused with relative strength .
What is Stochastic?
The stochastic oscillator, also known as stochastic indicator, is a popular trading indicator that is useful for predicting trend reversals. It also focuses on price momentum and can be used to identify overbought and oversold levels in shares, indices, currencies and many other investment assets.
What is Loxxer?
The Loxxer indicator is a technical analysis tool that compares the most recent maximum and minimum prices to the previous period's equivalent price to measure the demand of the underlying asset.
What is Velocity?
In simple words, velocity is the speed at which something moves in a particular direction. For example as the speed of a car travelling north on a highway, or the speed a rocket travels after launching.
How to use
Long signal: All 4 indicators turn green
Short signal: All 4 indicators turn red
Included
Bar coloring
Alerts
Easy RSI by nnamWhat Does this Indicator Do?
The Easy RSI Indicator color codes candles based on their RSI Value vs. Open / Close (Red / Green). It plots the current price and current RSI value on the chart in real-time. Additionally, when the RSI Value is in an oversold or overbought condition, it plots that signal on the chart in real-time.
The initial candle color is the standard Red / Green Tradingview color, but a Gradient is added to the color which either darkens or lightens the color based on the RSI Value.
As seen in the screenshot below, the higher the RSI Value, the brighter the Green Color is. The lower the RSI Value, the brighter the Red Color is.
The current Price and current RSI Value are both plotted on the chart by default, but can be optionally switched off by the trader.
As seen in the screenshot below, the prices and RSI Values are easily seen while visually tracking the price in real-time.
RSI Overbought Values are plotted when the Overbought condition is triggered. The Default is RED for Overbought and GREEN for Oversold.
As seen in the screenshot below, with all three labels turned on under the input settings (these are ON by default) you can see the overbought condition, the current RSI Value, and current price all in one centralized area. Oversold Values are also plotted when turned on under the input settings.
As shown in the screenshot below, the candle is GREEN (as evident by the green candle outline) but the RSI Value is low and shows lower than average relative strength. This turns the bar color ORANGE vs, GREEN showing that the relative strength of the move is subpar.
As shown on the screenshot below, if the trader has the standard Tradingview Price label switched on (in the Tradingview Chart Settings), the color of the bar is also translated to the price are for an easy to recognize RSI Value just by looking at the price. Even if the current candle is RED, when the RSI is higher than lower, the color will be green / greenish and even if the current candle is GREEN, when the RSI Value is lower than higher, the color will be red-ish / orange in color giving the user a quick view of RSI Value.
If you have any questions or feature requests for this Indicator please do not hesitate to reach out and ask.
GOOD LUCK trading!!
~nnamdert
Price & Percentage Change LabelFairly straightforward script that allows you to plot the current price and % either above the last candle and/or to the right of it. There's also 2 price "follow" lines that you can turn off and on, much like the bid/ask line that's built in to TV.
You can also choose to enable a specific % above/below current price to give you an idea on where price would be with a move north or south by X % amount from current price.
Ehlers Data Sampling Relative Strength Indicator [CC]The Data Sampling Indicator was created by John Ehlers (Stocks and Commodities Mar 2023) and this is a genius method to reduce noise in the market data but also doesn't introduce any lag while doing so. The way this works is because traditionally, people have always relied on the close price as the default input for many indicators such as the RSI or MACD as examples. Since the open is usually virtually identical to the previous close, it has been ignored by most people but Ehlers discovered that if you do a simple average of open and close for the input on any indicator, you can remove much of the noise without any added lag. I have used the RSI as he did in his example and plotted both to show the difference between the traditional RSI and using Ehlers' process as the new Data Sampling RSI. You can clearly see that this new RSI follows the price fluctuations much closer and is much smoother than the traditional RSI. As usual, I have included different colors to show the strength of the buy or sell signals so darker colors mean it is a very strong signal and lighter colors means it is a normal signal. Buy when the line turns green and sell when it turns red.
Feel free to try out this method to replace the input for any indicator and let me know how this works for you! And of course let me know if you would like me to publish any indicator script.
RSIOMA with Volume Index ConfirmationThis indicator is called "RSIOMA with Volume Index Confirmation". It is a technical analysis tool that plots buy and sell signals on a chart based on the Relative Strength Index (RSI) and the Negative Volume Index (NVI) and Positive Volume Index (PVI) indicators.
The indicator has the following input parameters:
- RSI Length: determines the number of periods used to calculate the RSI. Default value is 14.
- Overbought Level: determines the RSI level at which a security is considered overbought. Default value is 70.
- Oversold Level: determines the RSI level at which a security is considered oversold. Default value is 30.
- NVI Length: determines the number of periods used to calculate the Negative Volume Index. Default value is 255.
- PVI Length: determines the number of periods used to calculate the Positive Volume Index. Default value is 255.
The indicator calculates the RSI using the RSI Length input parameter and the close price of the security. It also calculates the NVI and PVI by looping through the volume data and the close price data of the security over the specified periods.
The indicator then uses the RSI, NVI, and PVI to determine buy and sell signals. A bearish divergence signal is generated when the RSI from one period ago is greater than the Overbought Level, the current RSI is less than the Overbought Level, and the close price from one period ago is greater than the current close price. A bullish divergence signal is generated when the RSI from one period ago is less than the Oversold Level, the current RSI is greater than the Oversold Level, and the close price from one period ago is less than the current close price. A sell signal is generated when a bearish divergence signal occurs and the current NVI is less than the previous NVI value. A buy signal is generated when a bullish divergence signal occurs and the current PVI is greater than the previous PVI value.
The indicator plots the buy and sell signals on the chart as green and red triangles, respectively. The "overlay=true" parameter in the indicator function indicates that the signals are plotted on top of the security's price chart.
BB Running Away CandleHello,
here is an indicator that can be helpful for your trading that is simple and easy to use.
Our culprit here is a candle that opens and closes below the lower band of Bollinger Band, Black and red lines are put on the high and low of that candle.
Green Arrows are happening when:
1- When candle closes above the black line and Stochastic RSI is in the oversold area >> "Confirmed B"
2- When candle closes above the black line >> "B"
Note that you can choose from the settings whether you want it confirmed or not.
Red Arrows are happening when:
1- Price reached the higher band of Bollinger Bands >> "BB High"
2- Stochastic crosses down from above 80 level >> "Stoch Crossdown"
3- RSI reached above 70 levle >> "RSI Oversold"
Note that you can choose to turn these on or off from the settings.
Settings of indicators are set to default.
NOTE: Alerts are put there however i didn't get the chance to test them, so would like to hear your feedback about them.
THE USE OF THIS INDICATOR IS YOUR OWN RESPONSIBILITY.
wishing you the best.
Kimchi Premium StrategyThis strategy is based on the Korea Premium, also known as the “Kimchi Premium,” which indicates how expensive or cheap the price of Bitcoin in Korean Won on a Bitcoin exchange in South Korea is relative to the price of Bitcoin being traded in USD or Tether. Inverse Kimchi Premium RSI was newly defined to create a strategy with Kimchi Premium. Assuming that the larger the kimchi premium, the greater the individual's purchasing power. In this case, if the Inverse Kimchi Premium RSI falls and closes the candle below the bear level, a short is triggered. Long is the opposite.
This strategy defaults to a combination of the traditional RSI and the Inverse Kimchi Premium RSI. If the user wishes to unlock the Inverse Kimchi Premium RSI combination and only use it as a traditional RSI strategy, the following settings can be used.
Use Combination of Inverse Kimchi Premium RSI: Uncheck
Resolution: Chart (4hr Candle)
Source: Close
Length of RSI: 14
Bull Level: 74
Bear Level: 25
__________________________________________________________________________________
김치프리미엄(김프) 전략은 달러 혹은 테더로 거래되고 있는 비트코인 가격 대비 한국에 있는 비트코인 거래소의 비트코인 원화 가격이 얼마나 비싸고 싼 지를 나타내는 코리아 프리미엄, 일명 "김치 프리미엄" 지표를 기반으로 만들어졌습니다. 김치 프리미엄을 가지고 전략을 만들기위해 Inverse Kimchi Premium RSI를 새롭게 정의하였습니다. 김치 프리미엄이 커질수록 개인의 매수세가 커진다고 가정하고, 이 경우 Inverse Kimchi Premium RSI이 하락하여 Bear Level 아래에서 캔들 마감을 하면 Short을 트리거 합니다. Long은 그 반대입니다.
이 전략은 전통적인 RSI와 Inverse Kimchi Premium RSI을 조합하여 기본값을 설정하였습니다. 유저가 원한다면 Inverse Kimchi Premium RSI의 조합을 해제하고 전통적인 RSI 전략으로만 사용하려면 아래 다음의 설정값을 사용할 수 있습니다.
Use Combination of Inverse Kimchi Premium RSI: 체크 해제
Resolution: Chart (4hr Candle)
Source: Close
Length of RSI: 14
Bull Level: 74
Bear Level: 25
RSI with Market FilterThis is a normal Relative Strength Index with default length set to 14 periods
In addition, SET and MAI market Trend filter:
When SET or MAI is above 10 and 35 EMA - consider as a strong uptrend.
SET or MAI is below EMA 10 but still above EMA 35 - consider as a healthy Uptrend but resting with lower momentum.
SET or MAI is below EMA 10 and 35 - consider as a Downtrend. It is recommended not to trade in this market.
SET or MAI is above EMA 10 but below EMA 35 - consider as a starting point of the uptrend. It is recommended to start looking for a possible trade when the market flip into Uptrend.
Dynamo
╭━━━╮
╰╮╭╮┃
╱┃┃┃┣╮╱╭┳━╮╭━━┳╮╭┳━━╮
╱┃┃┃┃┃╱┃┃╭╮┫╭╮┃╰╯┃╭╮┃
╭╯╰╯┃╰━╯┃┃┃┃╭╮┃┃┃┃╰╯┃
╰━━━┻━╮╭┻╯╰┻╯╰┻┻┻┻━━╯
╱╱╱╱╭━╯┃
╱╱╱╱╰━━╯
Overview
Dynamo is built to be the Swiss-knife for price-movement & strength detection, it aims to provide a holistic view of the current price across multiple dimensions. This is achieved by combining 3 very specific indicators(RSI, Stochastic & ADX) into a single view. Each of which serve a different purpose, and collectively provide a simple, yet powerful tool to gauge the true nature of price-action.
Background
Dynamo uses 3 technical analysis tools in conjunction to provide better insights into price movement, they are briefly explained below:
Relative Strength Index(RSI)
RSI is a popular indicator that is often used to measure the velocity of price change & the intensity of directional moves. RSI computes the relative strength of the current price by comparing the security’s bullish strength versus bearish strength for a given period, i.e. by comparing average gain to average loss.
It is a range bound(0-100) variable that generates a bullish reading if average gain is higher, and a bullish reading if average loss is higher. Values over 50 are generally considered bullish & values less than 50 indicate a bearish market. Values over 70 indicate an overbought condition, and values below 30 indicate oversold condition.
Stochastic
Stochastic is an indicator that aims to measure the momentum in the market, by comparing most recent closing price of the security to its price range for a given period. It is based on the assumption that price tends to close near the recent high in an up trend, and it closes near the recent low during a down trend.
It is also range bound(0-100), values over 80 indicate overbought condition and values below 20 indicate oversold condition.
Average Directional Index(ADX)
ADX is an indicator that can quantify trend strength, it is derived from two underlying indices, known as Directional Movement Index(DMI). +DMI represents strength of the up trend, and -DMI represents strength of the down trend, and ADX is the average of the two.
ADX is non-directional or trend-neutral, which means, it does not follow the direction of the price, instead ADX will rise only when there is a strong trend, it does not matter if it’s an up trend or a down trend. Typical ranges of ADX are 25-50 for a strong trend, anything below 25 is considered as no trend or weak trend. ADX can frequently shoot upto higher values, but it generally finds exhaustion levels around the 60-75 range.
About the script
All these indicators are very powerful tools, but just like any other indicator they have their limitations. Stochastic & ADX can generate false signals in volatile markets, meaning price wouldn’t always follow through with what’s being indicated. ADX may even fail to generate a signal in less volatile markets, simply because it is based on moving averages, it tends to react slower to price changes. RSI can also lose it’s effectiveness when markets are trending strong, as it can stay in the overbought or oversold ranges for an extended period of time.
Dynamo aims to provide the trader with a much broader perspective by bringing together these contrasting indicators into a single simplified view. When Stochastic becomes less reliable in highly volatile conditions, one can cross validate their deduction by looking at RSI patterns. When RSI gets stuck in overbought or oversold range, one can refer to ADX to get better picture about the current trend. Similarly, various combinations of rules & setups can be formulated to get a more deterministic view, when working with either of these indicators.
There many possible use cases for a tool like this, and it totally depends on how you want to use it. An obvious option is to use it to trigger signals only after it has been confirmed by two or more indicators, for example, RSI & Stochastic make a great combination for cross-over or cross-under strategies. Some of the other options include trend detection, strength detection, reversals or price rejection points, possible duration of a trend, and all of these can very easily be translated into effective entry and exit points for trades.
How to use it
Dynamo is an easy-to-use tool, just add it to your chart and you’re good to start with your market analysis. Output consists of three overlapping plots, each of which tackle price movement from a slightly different angle.
Stochastic: A momentum indicator that plots the current closing price in relation to the price-range over a given period of time.
Can be used to detect the direction of the price movement, potential reversals, or duration of an up/down move.
Plotted as grey coloured histograms in the background.
Relative Strength Index(RSI): RSI is also a momentum indicator that measures the velocity with which the price changes.
Can be used to detect the speed of the price movement, RSI divergences can be a nice way to detect directional changes.
Plotted as an aqua coloured line.
Average Directional Index(ADX): ADX is an indicator that is used to measure the strength of the current trend.
Can be used to measure how strong the price movement is, both up and down, or to establish long terms trends.
Plotted as an orange coloured line.
Features
Provides a well-rounded view of the market movement by amalgamating some of the best strength indicators, helping traders make better informed decisions with minimal effort.
Simplistic plots that aim to convey clean signals, as a result, reducing clutter on the chart, and hopefully in the trader's head too.
Combines different types of indicators into a single view, which leads to an optimised use of the precious screen real-estate.
Final Note
Dynamo is designed to be minimalistic in functionality and in appearance, as it is being built to be a general purpose tool that is not only beginner friendly, but can also be highly-configurable to meet the needs of pro traders.
Thresholds & default values for the indicators are only suggestions based on industry standards, they may not be an exact match for all markets & conditions. Hence, it is advisable for the user to test & adjust these values according their securities and trading styles.
The chart highlights one of many possible setups using this tool, and it can used to create various types of setups & strategies, but it is also worth noting that the usability & the effectiveness of this tool also depends on the user’s understanding & interpretation of the underlying indicators.
Lastly, this tool is only an indicator and should only be perceived that way. It does not guarantee anything, and the user should do their own research before committing to trades based on any indicator.
Haydens RSI Trend TraderThis is a simple trend trading companion indicator for Hayden's Advanced RSI, which can be found here:
For best results, please be sure your oscillator and chart companion settings match. Detailed trade information & statistics can be found when hovering over any of the indicator labels. The backtesting results are not calculated the same as TradingView, and the original code can be found here
Shoutout to the following authors for the code snippets that were used in making this indicator: @lazybear @kiosefftrading @Koalafied_3 @mabonyi @Capissimo
The Perfect Support & ResistanceSupport & Resistance drawn based on overbought & oversold RSI . where the overbought acts as resistance and oversold acts as support.
It has 2 levels (for support and resistance - i call them level_n_high or level_n_low) for each lookback period. it checks the highest pivot and the lowest pivot based on the lookback period then we compare if rsi is higher than the highest pivot or the lowest pivot and we also check if rsi is overbought or oversold and if the statement is true, then we assign the high to the variable level_n_high or level_n_low. n being the number of levels. in total there are 5 levels with both high & low for 5 lookback periods. This is basically how the code works.
these levels can be accessed at any timeframe. the defaults are 5m and 30m.
RSI settings: (default)
-------------------
length - 14
source - close
overbought - 70
oversold - 30
lookback settings: (default)
---------------------
lookback_0 - 200
lookback_1 - 100
lookback_2 - 50
lookback_3 - 20
lookback_4 - 10
Timeframe Settings: (default)
-------------------
htf1 - 5m
htf2 - 30m
Enjoy!
RSI Impact Heat Map [Trendoscope]Here is a simple tool to measure and display outcome of certain RSI event over heat map.
🎲 Process
🎯Event
Event can be either Crossover or Crossunder of RSI on certain value.
🎯Measuring Impact
Impact of the event after N number of bars is measured in terms of highest and lowest displacement from the last close price. Impact can be collected as either number of times of ATR or percentage of price. Impact for each trigger is recorded separately and stored in array of custom type.
🎯Plotting Heat Map
Heat map is displayed using pine tables. Users can select heat map size - which can vary from 10 to 90. Selecting optimal size is important in order to get right interpretation of data. Having higher number of cells can give more granular data. But, chart may not fit into the window. Having lower size means, stats are combined together to get less granular data which may not give right picture of the results. Default value for size is 50 - meaning data is displayed in 51X51 cells.
Range of the heat map is adjusted automatically based on min and max value of the displacement. In order to filter out or merge extreme values, range is calculated based on certain percentile of the values. This will avoid displaying lots of empty cells which can obscure the actual impact.
🎲 Settings
Settings allow users to define their event, impact duration and reference, and few display related properties. The description of these parameters are as below:
🎲 Use Cases
In this script, we have taken RSI as an example to measure impact. But, we can do this for any event. This can be price crossing over/under upper/lower bollinger bands, moving average crossovers or even complex entry or exit conditions. Overall, we can use this to plot and evaluate our trade criteria.
🎲 Interpretation
Q1 - If more coloured dots appear on the top right corner of the table, then the event is considered to trigger high volatility and high risk environment.
Q2 - If more coloured dots appear on the top left corner, then the events are considered to trigger bearish environment.
Q3 - If more coloured dots appear on the bottom left corner of the chart, then the events are considered insignificant as they neither generate higher displacement in positive or negative side. You can further alter outlier percentage to reduce the bracket and hence have higher distribution move towards
Q4 - If more coloured dots appear on the bottom right corner, then the events are considered to trigger bullish environment.
Will also look forward to implement this as library so that any conditions or events can be plugged into it.
RSI Multi Symbol/Time Frame DetectorThis code is an implementation of the Relative Strength Index (RSI) indicator, which is a popular momentum indicator used in technical analysis. The RSI measures the strength of an asset's price action and provides information on whether the asset is overbought or oversold. The code also calculates a moving average of the RSI and allows the user to choose the type of moving average to be calculated (SMA, EMA, SMMA, WMA, or VWMA).
The user can select from different time frames (5, 15, 60, or 240), symbols (SP:SPX, OANDA:EURUSD, or OANDA:NZDUSD), RSI lengths, and moving average types and lengths.
The code starts by defining a function called "ma" for calculating different types of moving averages. This function takes as input the source data for the moving average calculation (the RSI), the length of the moving average, and the type of moving average. The function uses a switch statement to return the appropriate calculation based on the inputted moving average type.
Next, the code calculates the RSI and its moving average. The RSI is calculated using the well-known formula for the RSI, which involves calculating the average gains and losses over a specified period of time and then dividing the average gains by the average losses. The moving average is calculated using the "ma" function defined earlier.
Finally, the code allows the user to choose the symbol and time frame to be used in the RSI calculation, as well as the length of the RSI and the moving average, and the type of moving average. The user can choose from three symbols (SP:SPX, OANDA:EURUSD, OANDA:NZDUSD) and four time frames (5, 15, 60, and 240 minutes). The code then uses the "request.security" function to retrieve the RSI calculation for the selected symbol and time frame.
Note: This code is example for you to use multi timeframe/symbol in your indicator or Strategy , also prevent Repainting Calculation
change in rsiThis indicator will show how fast the rsi of a symbol is changing. you can see this as a differentiation function on rsi .
this will show the change in rsi in percentage.
Ex: suppose the rsi of a symbol at present is 60 and the previous value of rsi was 52,
as you can see the rsi has increased, which is a sign of the symbol being bullish .
this indicator will tell by what percentage the rsi of the symbol has increased or decreased.
for the above example, the change in rsi is 15.38% increase.
this is set to default chart time-frame.
JSS Table - RSI, DI+, DI-, ADXSimple table to show the values for indicators which can be used to initiate trades:
RSI: Long above 55 // Short below 45 // Choppy between 45-55
DI+: Long above 25
DI-: Short above 25
Note when to avoid trend trades:
- If DI+ and DI- are both below 25 then market is choppy
- If RSI is between 45-55 then market is choppy
Moving Average Cross and RSIThis is the updated version of the MAC cross Short/ Long indicator i had posted earlier in 2022.
This script includes a RSI and EMA of the RSI with fixed OB and OS Levels.
The purpose is to refine the amount of trades taken from the moving average cross on the 30 minute timeframe.
In the overlay, the red and green dots indicate weather the moving cross is a long or a short signal.
The theory when back tested is:
When the short signal is given, the EMA must be below 30 to enter a short.
When the long signal is given, the EMA must be above 64 to enter a long, anything in between is a false signal.
Only the first dot is meant to be a long or a short signal, not meant to be interpreted as being consecutive.
The data window is meant to be built in a way to easily set up indicators or strategies using Tradelab.ai software.
Any Oscillator Underlay [TTF]We are proud to release a new indicator that has been a while in the making - the Any Oscillator Underlay (AOU) !
Note: There is a lot to discuss regarding this indicator, including its intent and some of how it operates, so please be sure to read this entire description before using this indicator to help ensure you understand both the intent and some limitations with this tool.
Our intent for building this indicator was to accomplish the following:
Combine all of the oscillators that we like to use into a single indicator
Take up a bit less screen space for the underlay indicators for strategies that utilize multiple oscillators
Provide a tool for newer traders to be able to leverage multiple oscillators in a single indicator
Features:
Includes 8 separate, fully-functional indicators combined into one
Ability to easily enable/disable and configure each included indicator independently
Clearly named plots to support user customization of color and styling, as well as manual creation of alerts
Ability to customize sub-indicator title position and color
Ability to customize sub-indicator divider lines style and color
Indicators that are included in this initial release:
TSI
2x RSIs (dubbed the Twin RSI )
Stochastic RSI
Stochastic
Ultimate Oscillator
Awesome Oscillator
MACD
Outback RSI (Color-coding only)
Quick note on OB/OS:
Before we get into covering each included indicator, we first need to cover a core concept for how we're defining OB and OS levels. To help illustrate this, we will use the TSI as an example.
The TSI by default has a mid-point of 0 and a range of -100 to 100. As a result, a common practice is to place lines on the -30 and +30 levels to represent OS and OB zones, respectively. Most people tend to view these levels as distance from the edges/outer bounds or as absolute levels, but we feel a more way to frame the OB/OS concept is to instead define it as distance ("offset") from the mid-line. In keeping with the -30 and +30 levels in our example, the offset in this case would be "30".
Taking this a step further, let's say we decided we wanted an offset of 25. Since the mid-point is 0, we'd then calculate the OB level as 0 + 25 (+25), and the OS level as 0 - 25 (-25).
Now that we've covered the concept of how we approach defining OB and OS levels (based on offset/distance from the mid-line), and since we did apply some transformations, rescaling, and/or repositioning to all of the indicators noted above, we are going to discuss each component indicator to detail both how it was modified from the original to fit the stacked-indicator model, as well as the various major components that the indicator contains.
TSI:
This indicator contains the following major elements:
TSI and TSI Signal Line
Color-coded fill for the TSI/TSI Signal lines
Moving Average for the TSI
TSI Histogram
Mid-line and OB/OS lines
Default TSI fill color coding:
Green : TSI is above the signal line
Red : TSI is below the signal line
Note: The TSI traditionally has a range of -100 to +100 with a mid-point of 0 (range of 200). To fit into our stacking model, we first shrunk the range to 100 (-50 to +50 - cut it in half), then repositioned it to have a mid-point of 50. Since this is the "bottom" of our indicator-stack, no additional repositioning is necessary.
Twin RSI:
This indicator contains the following major elements:
Fast RSI (useful if you want to leverage 2x RSIs as it makes it easier to see the overlaps and crosses - can be disabled if desired)
Slow RSI (primary RSI)
Color-coded fill for the Fast/Slow RSI lines (if Fast RSI is enabled and configured)
Moving Average for the Slow RSI
Mid-line and OB/OS lines
Default Twin RSI fill color coding:
Dark Red : Fast RSI below Slow RSI and Slow RSI below Slow RSI MA
Light Red : Fast RSI below Slow RSI and Slow RSI above Slow RSI MA
Dark Green : Fast RSI above Slow RSI and Slow RSI below Slow RSI MA
Light Green : Fast RSI above Slow RSI and Slow RSI above Slow RSI MA
Note: The RSI naturally has a range of 0 to 100 with a mid-point of 50, so no rescaling or transformation is done on this indicator. The only manipulation done is to properly position it in the indicator-stack based on which other indicators are also enabled.
Stochastic and Stochastic RSI:
These indicators contain the following major elements:
Configurable lengths for the RSI (for the Stochastic RSI only), K, and D values
Configurable base price source
Mid-line and OB/OS lines
Note: The Stochastic and Stochastic RSI both have a normal range of 0 to 100 with a mid-point of 50, so no rescaling or transformations are done on either of these indicators. The only manipulation done is to properly position it in the indicator-stack based on which other indicators are also enabled.
Ultimate Oscillator (UO):
This indicator contains the following major elements:
Configurable lengths for the Fast, Middle, and Slow BP/TR components
Mid-line and OB/OS lines
Moving Average for the UO
Color-coded fill for the UO/UO MA lines (if UO MA is enabled and configured)
Default UO fill color coding:
Green : UO is above the moving average line
Red : UO is below the moving average line
Note: The UO naturally has a range of 0 to 100 with a mid-point of 50, so no rescaling or transformation is done on this indicator. The only manipulation done is to properly position it in the indicator-stack based on which other indicators are also enabled.
Awesome Oscillator (AO):
This indicator contains the following major elements:
Configurable lengths for the Fast and Slow moving averages used in the AO calculation
Configurable price source for the moving averages used in the AO calculation
Mid-line
Option to display the AO as a line or pseudo-histogram
Moving Average for the AO
Color-coded fill for the AO/AO MA lines (if AO MA is enabled and configured)
Default AO fill color coding (Note: Fill was disabled in the image above to improve clarity):
Green : AO is above the moving average line
Red : AO is below the moving average line
Note: The AO is technically has an infinite (unbound) range - -∞ to ∞ - and the effective range is bound to the underlying security price (e.g. BTC will have a wider range than SP500, and SP500 will have a wider range than EUR/USD). We employed some special techniques to rescale this indicator into our desired range of 100 (-50 to 50), and then repositioned it to have a midpoint of 50 (range of 0 to 100) to meet the constraints of our stacking model. We then do one final repositioning to place it in the correct position the indicator-stack based on which other indicators are also enabled. For more details on how we accomplished this, read our section "Binding Infinity" below.
MACD:
This indicator contains the following major elements:
Configurable lengths for the Fast and Slow moving averages used in the MACD calculation
Configurable price source for the moving averages used in the MACD calculation
Configurable length and calculation method for the MACD Signal Line calculation
Mid-line
Note: Like the AO, the MACD also technically has an infinite (unbound) range. We employed the same principles here as we did with the AO to rescale and reposition this indicator as well. For more details on how we accomplished this, read our section "Binding Infinity" below.
Outback RSI (ORSI):
This is a stripped-down version of the Outback RSI indicator (linked above) that only includes the color-coding background (suffice it to say that it was not technically feasible to attempt to rescale the other components in a way that could consistently be clearly seen on-chart). As this component is a bit of a niche/special-purpose sub-indicator, it is disabled by default, and we suggest it remain disabled unless you have some pre-defined strategy that leverages the color-coding element of the Outback RSI that you wish to use.
Binding Infinity - How We Incorporated the AO and MACD (Warning - Math Talk Ahead!)
Note: This applies only to the AO and MACD at time of original publication. If any other indicators are added in the future that also fall into the category of "binding an infinite-range oscillator", we will make that clear in the release notes when that new addition is published.
To help set the stage for this discussion, it's important to note that the broader challenge of "equalizing inputs" is nothing new. In fact, it's a key element in many of the most popular fields of data science, such as AI and Machine Learning. They need to take a diverse set of inputs with a wide variety of ranges and seemingly-random inputs (referred to as "features"), and build a mathematical or computational model in order to work. But, when the raw inputs can vary significantly from one another, there is an inherent need to do some pre-processing to those inputs so that one doesn't overwhelm another simply due to the difference in raw values between them. This is where feature scaling comes into play.
With this in mind, we implemented 2 of the most common methods of Feature Scaling - Min-Max Normalization (which we call "Normalization" in our settings), and Z-Score Normalization (which we call "Standardization" in our settings). Let's take a look at each of those methods as they have been implemented in this script.
Min-Max Normalization (Normalization)
This is one of the most common - and most basic - methods of feature scaling. The basic formula is: y = (x - min)/(max - min) - where x is the current data sample, min is the lowest value in the dataset, and max is the highest value in the dataset. In this transformation, the max would evaluate to 1, and the min would evaluate to 0, and any value in between the min and the max would evaluate somewhere between 0 and 1.
The key benefits of this method are:
It can be used to transform datasets of any range into a new dataset with a consistent and known range (0 to 1).
It has no dependency on the "shape" of the raw input dataset (i.e. does not assume the input dataset can be approximated to a normal distribution).
But there are a couple of "gotchas" with this technique...
First, it assumes the input dataset is complete, or an accurate representation of the population via random sampling. While in most situations this is a valid assumption, in trading indicators we don't really have that luxury as we're often limited in what sample data we can access (i.e. number of historical bars available).
Second, this method is highly sensitive to outliers. Since the crux of this transformation is based on the max-min to define the initial range, a single significant outlier can result in skewing the post-transformation dataset (i.e. major price movement as a reaction to a significant news event).
You can potentially mitigate those 2 "gotchas" by using a mechanism or technique to find and discard outliers (e.g. calculate the mean and standard deviation of the input dataset and discard any raw values more than 5 standard deviations from the mean), but if your most recent datapoint is an "outlier" as defined by that algorithm, processing it using the "scrubbed" dataset would result in that new datapoint being outside the intended range of 0 to 1 (e.g. if the new datapoint is greater than the "scrubbed" max, it's post-transformation value would be greater than 1). Even though this is a bit of an edge-case scenario, it is still sure to happen in live markets processing live data, so it's not an ideal solution in our opinion (which is why we chose not to attempt to discard outliers in this manner).
Z-Score Normalization (Standardization)
This method of rescaling is a bit more complex than the Min-Max Normalization method noted above, but it is also a widely used process. The basic formula is: y = (x – μ) / σ - where x is the current data sample, μ is the mean (average) of the input dataset, and σ is the standard deviation of the input dataset. While this transformation still results in a technically-infinite possible range, the output of this transformation has a 2 very significant properties - the mean (average) of the output dataset has a mean (μ) of 0 and a standard deviation (σ) of 1.
The key benefits of this method are:
As it's based on normalizing the mean and standard deviation of the input dataset instead of a linear range conversion, it is far less susceptible to outliers significantly affecting the result (and in fact has the effect of "squishing" outliers).
It can be used to accurately transform disparate sets of data into a similar range regardless of the original dataset's raw/actual range.
But there are a couple of "gotchas" with this technique as well...
First, it still technically does not do any form of range-binding, so it is still technically unbounded (range -∞ to ∞ with a mid-point of 0).
Second, it implicitly assumes that the raw input dataset to be transformed is normally distributed, which won't always be the case in financial markets.
The first "gotcha" is a bit of an annoyance, but isn't a huge issue as we can apply principles of normal distribution to conceptually limit the range by defining a fixed number of standard deviations from the mean. While this doesn't totally solve the "infinite range" problem (a strong enough sudden move can still break out of our "conceptual range" boundaries), the amount of movement needed to achieve that kind of impact will generally be pretty rare.
The bigger challenge is how to deal with the assumption of the input dataset being normally distributed. While most financial markets (and indicators) do tend towards a normal distribution, they are almost never going to match that distribution exactly. So let's dig a bit deeper into distributions are defined and how things like trending markets can affect them.
Skew (skewness): This is a measure of asymmetry of the bell curve, or put another way, how and in what way the bell curve is disfigured when comparing the 2 halves. The easiest way to visualize this is to draw an imaginary vertical line through the apex of the bell curve, then fold the curve in half along that line. If both halves are exactly the same, the skew is 0 (no skew/perfectly symmetrical) - which is what a normal distribution has (skew = 0). Most financial markets tend to have short, medium, and long-term trends, and these trends will cause the distribution curve to skew in one direction or another. Bullish markets tend to skew to the right (positive), and bearish markets to the left (negative).
Kurtosis: This is a measure of the "tail size" of the bell curve. Another way to state this could be how "flat" or "steep" the bell-shape is. If the bell is steep with a strong drop from the apex (like a steep cliff), it has low kurtosis. If the bell has a shallow, more sweeping drop from the apex (like a tall hill), is has high kurtosis. Translating this to financial markets, kurtosis is generally a metric of volatility as the bell shape is largely defined by the strength and frequency of outliers. This is effectively a measure of volatility - volatile markets tend to have a high level of kurtosis (>3), and stable/consolidating markets tend to have a low level of kurtosis (<3). A normal distribution (our reference), has a kurtosis value of 3.
So to try and bring all that back together, here's a quick recap of the Standardization rescaling method:
The Standardization method has an assumption of a normal distribution of input data by using the mean (average) and standard deviation to handle the transformation
Most financial markets do NOT have a normal distribution (as discussed above), and will have varying degrees of skew and kurtosis
Q: Why are we still favoring the Standardization method over the Normalization method, and how are we accounting for the innate skew and/or kurtosis inherent in most financial markets?
A: Well, since we're only trying to rescale oscillators that by-definition have a midpoint of 0, kurtosis isn't a major concern beyond the affect it has on the post-transformation scaling (specifically, the number of standard deviations from the mean we need to include in our "artificially-bound" range definition).
Q: So that answers the question about kurtosis, but what about skew?
A: So - for skew, the answer is in the formula - specifically the mean (average) element. The standard mean calculation assumes a complete dataset and therefore uses a standard (i.e. simple) average, but we're limited by the data history available to us. So we adapted the transformation formula to leverage a moving average that included a weighting element to it so that it favored recent datapoints more heavily than older ones. By making the average component more adaptive, we gained the effect of reducing the skew element by having the average itself be more responsive to recent movements, which significantly reduces the effect historical outliers have on the dataset as a whole. While this is certainly not a perfect solution, we've found that it serves the purpose of rescaling the MACD and AO to a far more well-defined range while still preserving the oscillator behavior and mid-line exceptionally well.
The most difficult parts to compensate for are periods where markets have low volatility for an extended period of time - to the point where the oscillators are hovering around the 0/midline (in the case of the AO), or when the oscillator and signal lines converge and remain close to each other (in the case of the MACD). It's during these periods where even our best attempt at ensuring accurate mirrored-behavior when compared to the original can still occasionally lead or lag by a candle.
Note: If this is a make-or-break situation for you or your strategy, then we recommend you do not use any of the included indicators that leverage this kind of bounding technique (the AO and MACD at time of publication) and instead use the Trandingview built-in versions!
We know this is a lot to read and digest, so please take your time and feel free to ask questions - we will do our best to answer! And as always, constructive feedback is always welcome!
Multi Timeframe Stochastic RSI ScreenerThis script is also a Stochastic RSI Screener, but it allows users to choose one specific symbol and three timeframes of that symbol to monitor at once.
RSI TREND FILTERRSI TREND Filter on Chart
RSI scaled to fit on chart instead of oscillator, Trend Analysis is easy and Hidden Divergence is revealed using this indicator. This indicator is an aim to reduce confusing RSI Situations. The Oversold and Overbought lines help to determine the price conditions so its easy to avoid Traps.
Oversold and Overbought conditions are marked on Chart to make it useful to confirm a Buy or Sell Signals.
RSI 50 level is plotted with reference to EMA50 and Oversold and Overbought Conditions are calculated accordingly.
Uptrend: RSI Cloud / Candles above RSI 50 Level
Down Trend: RSI Cloud / Candles below RSI 50 Level
Sideways : Candles in the Gray Area above and below RSI 50 Level
Default RSI (14) : is the Candlestick pattern itself
Disclaimer: Use Solely at your own Risk.
Stochastic RSI ScreenerStochastic RSI Screener is built as an indicator and can be applied to any chart.
It gives users the ability to choose 5 specific symbols to watch and then specify the required options to change the RSI and Stochastic settings in a way that fits their needs.
This screener shows the values of (CURRENT PRICE, RSI, K-VALUE, D-VALUE) for each one of the specified symbols. It will do the calculations based on the currently opened timeframe for all symbols.