Machine Learning: Support and Resistance [YinYangAlgorithms]Overview:
Support and Resistance is normally based upon Pivot Points and Highest Highs and Lowest Lows. Many times coders even incorporate Volume, RSI and other factors into the equation. However there may be a downside to doing a pure technical approach based on historical levels. We live in a time where Machine Learning is becoming more and more used; thus we have decided to create a Machine Learning Support and Resistance Projection based Indicator. Rather than using traditional Support and Resistance calculations using historical data, we have taken a rather different approach. This Indicator instead attempts to Predict and Project where Support and Resistance locations will be based on a Machine Learning Model using a form of KNN (k-Nearest Neighbors).
Since this indicator creates a Projection of where it deems Support and Resistance will be, it has the ability to move its Support and Resistance before the price even gets to it if it believes it will surpass its projections. This may create a more accurate placement of Support and Resistance as they’re not based on historical levels.
This Indicator does not Repaint.
How it works:
This Indicator makes its projections based on the source you provide (by default close) of the previous bar and submits the source, RSI and EMA to our Projection Function to get its projection of the current bar.
The Projection function essentially calculates potential movement after finding the differences between the source the MA from the current bar, previous bar and average over the span of Machine Learning Length.
Potential movement is defined as:
Average Difference + Average(Machine Learning Average, Average Last Distance)
Average Difference: (Absolute value of Current Source - Current MA) - (Absolute value of Machine Learning Average - Machine Learning MA)
Average Last Distance: Average(Current Source - Current MA, Previous Source - Previous MA)
It then predicts the next bars directional movement (bullish or bearish bar) using several factors:
Previous Source > Previous MA
Current Source - Current MA > Average Source - Average MA
Current RSI > Previous RSI
Current RSI > 30 and Previous RSI <= 30
Current RSI < 70 and Previous RSI >= 70
This helps us to predict the direction the next bar may move.
We then calculate a multiplier that we apply to our Potential Movement value to get our final result which is our Current Bars Close Projection.
Our multiplier is calculated using:
(Current RSI > 30 and Previous RSI <= 30) OR (Current RSI < 70 and Previous RSI >= 70)
Current Source - Current MA > Previous Source - Previous MA
We then create an array and fill it with the previous X projections (Machine Learning Length) and send it to another function. This function, if told to, will sort the data accordingly and then output the KNN average of the length given.
We calculate and plot various KNN lengths to create different Zones:
Strong Support: Length of 2 but sort the data Ascending (low to high)
Strong Resistance: Length of 2 but sort the data Descending (high to low)
Support: Length of Machine Length Length / 10 or Min of 2 sorted by Ascending
Resistance: Length of Machine Length Length / 10 or Min of 2 sorted by Descending
There are also 4 other plots you may be wondering what they are, there is your AVG, VWMA, Long Term Memory and Current Projection.
By default your Current Projection is disabled in settings but you can enable it if you are curious to see how the projections for each close are calculated. It is, however, not a crucial point of interest (white line).
The average is simply the average value of the Machine Learning Data (purple line).
The VWMA is a VWMA calculation applied to our Data over a length specified in settings (by default 1)(blue line). The VWMA is crucial when combined with the Avg as they can cross over and under each other. These crosses represent potential Bullish and Bearish zones.
Lastly, but certainly not least, we have the Long Term Memory (maroon line). The Long Term Memory can be displayed either as an ‘Average’, ‘Hard Line’ or ‘None’. The Long Term Average is only updated every Machine Learning Length Bar Index’s and is populated with the average of the Machine Learning Data. For Instance, if Machine Learning Length is set to 100, the Long Term Memory is only updated every 100 bars, and since its length is the same as the Machine Learning Length, that means its data is composed of 10,000 bars worth of data. The Long Term Memory may be very beneficial for determining where Support and Resistance lie over the Long Term within a Machine Learning Algorithm. When set to ‘Average’ it plots the connection lines diagonally, and although they may be more visually appealing, they’re less useful when it comes to actually seeing support and resistance as generally speaking, support and resistance lie on the horizontal. When set to ‘Hard Line’ the Long Term Memory is connected with hard lines and holds the price value until the next time it is updated. This makes it much more useful for potentially identifying Support and Resistance.
Tutorial:
Here is an overview of what the Indicator looks like, now let's start to dissect it.
In the example above we can see how all of the lines between the Major Support and Resistance zones may act as BOTH Support and Resistance depending on which side the price is currently on. In the circle on the left, we can see how it can fluctuate between the two. If you look at the circle on the right, we can see how the Average line acts as a strong support before it fails to maintain it. Generally speaking, most Support and Resistance locations may potentially fail to hold after 3 tests, as the Average did in this example.
As you can see, the Support and Resistance doesn’t wait to be tested before adjusting, which is why there are 2 lines which create their zones. The inner line is the Support/Resistance and the outer line is the Strong Support/Resistance. The Yellow Circle shows the inner line was able to calculate the moving resistance correctly and then adjusted accordingly as it was projecting the price to keep increasing. However, if you look at the White Circle, you can see that since there was first a crash, and then parabolic movement, that the inner zone could not move and predict the resistance as well as the outer zone could.
We consider the price to be ‘Overvalued’ when it is above the VWMA (blue line) and ‘Undervalued’ when it is below the VWMA. It is considered ‘fair’ price when it is within the VWMA to Average zone (between the blue and purple lines). If you look at the example above, you’ll notice where the two yellow circles are, it is not only considered ‘Overvalued’, but it then proceeds to ride the inner resistance line upwards. This is common when the market is overly bullish and vice versa when it is bearish. Please keep in mind, although it is common, it doesn’t mean a correction can’t happen.
In this example above we look at the last bull run that may have started due to the halving. This bull run was very bullish as you can see in the example above. The price was constantly sitting within the Resistance Zone and the VWMA that was very close to it was constantly acting as a Support. Naturally, due to the Algorithm used in this Indicator, as the momentum starts to slow down, the VWMA (blue line) will start to space out more and more from the Resistance Zone. This doesn’t mean the momentum is gone, it just means it may be slowing down.
Unfortunately we have to study the Bear Market with a different perspective than the Bull Market. However, there are still some similarities within the two. If you refer to the example above and the previous example, you can clearly see that the Bull Market loves to stay with the Resistance Zone and use the VWMA as a Support. However, the Bear Market does not. This is a normal occurrence, however we can see from the example above you may see a correction / horizontal movement when the Outer Support Line is touched. If you look at all 3 yellow circles, the Outer Support Line was touched, then either a small correction or horizontal consolidation occurred.
We will conclude our Tutorial here, hopefully you’ll be able to benefit from a moving Support and Resistance calculated with Machine Learning that projects its locations, rather than using traditional calculations.
Settings:
Source: This source is the base for all our calculations
Machine Learning Length: How much projection data are we storing and using to make calculations.
Smoothing Length: We need to smooth calculations such as RSI, EMA and VWMA. What length are we smoothing it with?
VWMA ML Projection Length: How far into our Machine Learning data should we average for our VWMA. Please note the 'Smoothing Length' is still applied here after getting the Projection Average.
Long Term Memory: Long term memory has the same storage length but is only updated once per Machine Learning Length. For instance, if Machine Learning Length is 100, it will save the Average of our data once every 100 bars. This means its memory is an average of 10,000 bars of Machine Learning. 'Average' connects its values diagonally whereas 'Hard Line' holds its value until it changes.
Use Average Last Distance In Potential Movement: This can help accuracy but generally also displaces the Support and Resistance by projecting it further.
Show Current Projection: Projections occur for each bar, and our Machine Learning utilizes these projections by storing and evaluating them. This toggle will display the Current Projection Line which is used to create all our Projections.
If you have any questions, comments, ideas or concerns please don't hesitate to contact us.
HAPPY TRADING!
Поддержка и сопротивление
Liquidity Spike PoolThe “Liquidity Pools” indicator is a tool for market analysts that stands out for its ability to clearly project the intricate zones of manipulation present in financial markets. These crucial territories emerge when supply or demand takes over, resulting in long shadows (wicks) on the chart candles. Imagine these regions as "magnets" for prices, as they represent authentic "liquidity pools" where the flow of money into the market is significantly concentrated. But the value of the indicator goes beyond this simple visualization: these zones, when identified and interpreted correctly, can play a crucial role for traders looking for profitable entry points. They can mutate into important bastions of support or resistance, providing traders with key anchor points to make informed decisions within their trading strategies.
A key aspect to consider is the importance of different time frames in analyzing markets. Larger time frames, such as daily or 4h, tend to host larger and more relevant liquidity zones. Therefore, a successful strategy might involve identifying these areas of manipulation over longer time frames through the use of this indicator, and then applying these findings to shorter time frames. This approach allows you to turn manipulation zones into crucial reference points that merit constant surveillance while making trading decisions on shorter time frames.
The indicator uses color to convey information clearly and effectively:
- Dark blue lines highlight candles with significant upper wick, signaling the possible presence of an important manipulation area in the considered area.
- Dark red lines are reserved for sizable candlesticks with significant upper wick, emphasizing situations that are particularly relevant to traders.
- Dark gray lines highlight candles with significant lower wick, providing a valuable indication of manipulation zones where the bid may have prevailed.
- White lines highlight sizable candlesticks with significant lower wick, clearly indicating situations where demand has been predominant and may have helped form a liquidity pool.
This indicator constitutes an important resource for identifying and clearly displaying candles with significant wicks, allowing traders to distinguish between ordinary market conditions and circumstances particularly relevant to their trading strategies. Thanks to the distinctive colors of the lines, the indicator offers intuitive visual guidance, allowing traders to make more informed decisions while carrying out their analyses.
Range Breakout Signals (Intrabar) [LuxAlgo]The Range Breakout Signals (Intrabar) is a novel indicator highlighting trending/ranging intrabar candles and providing signals when the price breaks the extremities of a ranging intrabar candles.
🔶 USAGE
The indicator highlights candles with trending intrabar prices, with uptrending candles being highlighted in green, and down-trending candles being highlighted in red.
This highlighting is affected by the selected intrabar timeframe, with a lower timeframe returning a more precise estimation of a candle trending/ranging state.
When a candle intrabar prices are ranging the body of the candle is hidden from the chart, and one upper & lower extremities are displayed, the upper extremity is equal to the candle high and the lower extremity to the candle low. Price breaking one of these extremities generates a signal.
The indicator comes with two modes, "Trend Following" and "Reversal", these modes determine the extremities that need to be broken in order to return a signal. The "Trend Following" mode as its name suggests will provide trend-following signals, while "Reversal" will aim at providing early signals suggesting a potential reversal.
🔶 DETAILS
To determine if intrabar prices are trending or ranging we calculate the r-squared of the intrabar data, if the r-squared is above 0.5 it would suggest that lower time frame prices are trending, else ranging.
This approach allows almost obtaining a "settings" free indicator, which is uncommon. The intrabar timeframe setting only controls the intrabar precision, with a timeframe significantly lower than the chart timeframe returning more intrabar data as a result, this however might not necessarily affect the displayed information by the indicator.
🔶 SETTINGS
Intrabar Timeframe: Timeframe used to retrieve the intrabar data within a chart candle. Must be lower than the user chart timeframe.
Auto: Select the intrabar timeframe automatically. This setting is more adapted to intraday charts.
Mode: Signal generation mode.
Filter Out Successive Signals: Allows removing successive signals of the same type, returning a more easily readable chart.
Monthly Range Support & Resistance [QuantVue]The Monthly Range Support & Resistance Levels is an advanced analytical tool designed to assess monthly price movements and provide potential support and resistance levels.
This tool examines the average monthly price fluctuations over the past 7 months (default), and creates support and resistance levels based on the opening price.
The indicator also considers a standard deviation multiplier.
This enables traders and investors to identify potential price zones.
The support and resistance levels are dynamically updated every month.
Users can also choose to view previous daily levels as well.
Customizable settings for this tool include:
-Averaging Period: Adjust the number of months to calculate the average monthly range.
-Standard Deviation Multiplier: Modify the standard deviation multiplier to fine-tune the sensitivity of the support and resistance levels. A higher multiplier will result in wider levels, accommodating higher price fluctuations.
-Toggle Support & Resistance Prices: Easily switch on or off the display of support and resistance price levels.
-Show Monthly Open Line: Display the monthly opening price as a reference point on the chart.
-Show Previous Levels: Choose whether to display past daily support and resistance levels.
Note: this indicator works on a 1 hour timeframe or higher
Give this indicator a BOOST and COMMENT your thoughts!
We hope you enjoy.
Cheers!
Divergences RefurbishedJust as "a butterfly can flap its wings over a flower in China and cause a hurricane in the Caribbean" (Edward Lorenz), small divergences in markets can signal big trading opportunities.
█Introduction
This is a script forked from LonesomeTheBlue's Divergence for Many Indicators v4.
It is a script that checks for divergence between price and many indicators.
In this version, I added more indicators and also added 40 symbols to check for divergences.
More info on the original script can be found here:
█ Improvements
The following improvements have been implemented over v4:
1. Added parameters to customize indicators.
2. Added new indicators:
- Stoch RSI
- Volume Oscillator
- PVT (Price Volume Trend)
- Ultimate Oscillator
- Fisher Transform
- Z-Score/T-Score
3. Now there is the possibility of using 2 external indicators.
4. New option to show tooltips inside labels.
This allows you to save space on the screen if you choose the option to only show the number of divergences or just the abbreviations.
5. New option to show additional text next to the indicator name.
This allows for grouping of indicators and symbols and better visualization, whether through emojis, for example.
6. Added 40 customizable symbols to check for divergences.
7. Option "show only the first letter" of the indicator replaced by: "show the abbreviation of the indicator".
Reason: the indicator abbreviation is more informative and easier to read.
8. Script converted to PineScript version 5.
█ CONCEPTS
Below I present a brief description of the available indicators.
1. Moving Average Convergence/Divergence (MACD):
Shows the difference between short-term and long-term exponential moving averages.
2. MACD Histogram:
Shows the difference between MACD and its signal line.
3. Relative Strength Index (RSI):
Measures the relative strength of recent price gains to recent price losses of an asset.
4. Stochastic Oscillator (Stoch):
Compares the current price of an asset to its price range over a specified time period.
5. Stoch RSI:
Stochastic of RSI.
6. Commodity Channel Index (CCI):
Measures the relationship between an asset's current price and its moving average.
7. Momentum: Shows the difference between the current price and the price a few periods ago.
Shows the difference between the current price and the price of a certain period in the past.
8. Chaikin Money Flow (CMF):
A variation of A/D that takes into account the daily price variation and weighs trading volume accordingly. Accumulation/Distribution (A/D) identifies buying and selling pressure by tracking the flow of money into and out of an asset based on volume patterns.
9. On-Balance Volume (OBV):
Identify divergences between trading volume and an asset's price.
Sum of trading volume when the price rises and subtracts volume when the price falls.
10. Money Flow Index (MFI):
Measures volume pressure in a range of 0 to 100.
Calculates the ratio of volume when the price goes up and when the price goes down.
11. Volume Oscillator (VO):
Identify divergences between trading volume and an asset's price. Ratio of change of volume, from a fast period in relation to a long period.
12. Price-Volume Trend (PVT):
Identify the strength of an asset's price trend based on its trading volume. Cumulative change in price with volume factor. The PVT calculation is similar to the OBV calculation, but it takes into account the percentage price change multiplied by the current volume, plus the previous PVT value.
13. Ultimate Oscillator (UO):
Combines three different time periods to help identify possible reversal points.
14. Fisher Transform (FT):
Normalize prices into a Gaussian normal distribution.
15. Z-Score/T-Score: Shows the difference between the current price and the price a few periods ago. I is a statistical measurement that indicates how many standard deviations a data point is from the mean of a data set.
When to use t-score instead of z-score? When the sample size is small (length < 30).
Here, the use of z-score or t-score is chosen automatically based on the length parameter.
█ What to look for
The operation is simple. The script checks for divergences between the price and the selected indicators.
Now with the possibility of using multiple symbols, it is possible to check divergences between different assets.
A well-described view on divergences can be found in this cheat sheet:
◈ Examples with SPY ETF versus indicators:
1. Regular bullish divergence with external indicator:
1. Regular bearish divergence with Fisher Transform:
1. Positive hidden divergence with Momentum indicator:
1. Negative hidden divergence with RSI:
◈ Examples with SPY ETF versus other symbols:
1. Regular bearish divergence with European Stoch Market:
2. Regular bearish divergence with DXY inverted:
3. Regular bullish divergence with Taiwan Dollar:
4. Regular bearish divergence with US10Y (10-Year US Treasury Note):
5. Regular bullish divergence with QQQ ETF (Nasdaq 100):
6. Regular bullish divergence with ARKK ETF (ARK Innovation):
7.Positive hidden divergence with RSP ETF (S&P 500 Equal Weight):
8. Negative hidden divergence with EWZ ETF (Brazil):
◈ Examples with BTCUSD versus other symbols:
1. Regular bearish divergence with BTCUSDLONGS from Bitfinex:
2. Regular bearish divergence with BLOK ETF (Amplify Transformational Data Sharing):
3. Negative hidden divergence with NATGAS (Natural Gas):
4. Positive hidden divergence with TOTALDEFI (Total DeFi Market Cap):
█ Conclusion
The symbols available to check divergences were chosen in such a way as to cover the main markets, in the most generic way possible.
You can adjust them according to your needs.
A trader in the American market, for example, could add more ETFs, American stocks, and sectoral indices, such as the XLF (Financial Select Sector SPDR Fund), the XLK (Technology Select Sector SPDR), etc.
On the other hand, a cryptocurrency trader could add more currency pairs and sector indicators, such as BTCUSDSHORTS (Bitfinex), USDT.D (Tether Dominance), etc.
If the chart becomes too cluttered, you can use the option to show only the number of divergences or only the indicator abbreviations.
Or even disable certain indicators and symbols, if they are not of interest to you.
I hope this script is useful.
Don't forget to support LonesomeTheBlue's work too.
DIY Custom Strategy Builder [ZP] - v1DISCLAIMER:
This indicator as my first ever Tradingview indicator, has been developed for my personal trading analysis, consolidating various powerful indicators that I frequently use. A number of the embedded indicators within this tool are the creations of esteemed Pine Script developers from the TradingView community. In recognition of their contributions, the names of these developers will be prominently displayed alongside the respective indicator names. My selection of these indicators is rooted in my own experience and reflects those that have proven most effective for me. Please note that the past performance of any trading system or methodology is not necessarily indicative of future results. Always conduct your own research and due diligence before using any indicator or tool.
===========================================================================
Introducing the ultimate all-in-one DIY strategy builder indicator, With over 30+ famous indicators (some with custom configuration/settings) indicators included, you now have the power to mix and match to create your own custom strategy for shorter time or longer time frames depending on your trading style. Say goodbye to cluttered charts and manual/visual confirmation of multiple indicators and hello to endless possibilities with this indicator.
What it does
==================
This indicator basically help users to do 2 things:
1) Strategy Builder
With more than 30 indicators available, you can select any combination you prefer and the indicator will generate buy and sell signals accordingly. Alternative to the time-consuming process of manually confirming signals from multiple indicators! This indicator streamlines the process by automatically printing buy and sell signals based on your chosen combination of indicators. No more staring at the screen for hours on end, simply set up alerts and let the indicator do the work for you.
Available indicators that you can choose to build your strategy, are coded to seamlessly print the BUY and SELL signal upon confirmation of all selected indicators:
EMA Filter
2 EMA Cross
3 EMA Cross
Range Filter (Guikroth)
SuperTrend
Ichimoku Cloud
SuperIchi (LuxAlgo)
B-Xtrender (QuantTherapy)
Bull Bear Power Trend (Dreadblitz)
VWAP
BB Oscillator (Veryfid)
Trend Meter (Lij_MC)
Chandelier Exit (Everget)
CCI
Awesome Oscillator
DMI ( Adx )
Parabolic SAR
Waddah Attar Explosion (Shayankm)
Volatility Oscillator (Veryfid)
Damiani Volatility ( DV ) (RichardoSantos)
Stochastic
RSI
MACD
SSL Channel (ErwinBeckers)
Schaff Trend Cycle ( STC ) (LazyBear)
Chaikin Money Flow
Volume
Wolfpack Id (Darrellfischer1)
QQE Mod (Mihkhel00)
Hull Suite (Insilico)
Vortex Indicator
2) Overlay Indicators
Access the full potential of this indicator using the SWITCH BOARD section! Here, you have the ability to turn on and plot up to 14 of the included indicators on your chart. Simply select from the following options:
EMA
Support/Resistance (HeWhoMustNotBeNamed)
Supply/ Demand Zone ( SMC ) (Pmgjiv)
Parabolic SAR
Ichimoku Cloud
Superichi (LuxAlgo)
SuperTrend
Range Filter (Guikroth)
Average True Range (ATR)
VWAP
Schaff Trend Cycle ( STC ) (LazyBear)
PVSRA (TradersReality)
Liquidity Zone/Vector Candle Zone (TradersReality)
Market Sessions (Aurocks_AIF)
How it does it
==================
To explain how this indictor generate signal or does what it does, its best to put in points.
I have coded the strategy for each of the indicator, for some of the indicator you will see the option to choose strategy variation, these variants are either famous among the traders or its the ones I found more accurate based on my usage. By coding the strategy I will have the BUY and SELL signal generated by each indicator in the backend.
Next, the indicator will identify your selected LEADING INDICATOR and the CONFIRMATION INDICATOR(s).
On each candle close, the indicator will check if the selected LEADING INDICATOR generates signal (long or short).
Once the leading indicator generates the signal, then the indicator will scan each of the selected CONFIRMATION INDICATORS on candle close to check if any of the CONFIRMATION INDICATOR generated signal (long or short).
Until this point, all the process is happening in the backend, the indicator will print LONG or SHORT signal on the chart ONLY if LEADING INDICATOR and all the selected CONFIRMATION INDICATORS generates signal on candle close. example for long signal, the LEADING INDICATOR and all selected CONFIRMATION INDICATORS must print long signal.
The dashboard table will show your selected LEADING and CONFIRMATION INDICATORS and if LEADING or the CONFIRMATION INDICATORS have generated signal. Signal generated by LEADING and CONFIRMATION indicator whether long or short, is indicated by tick icon ✔. and if any of the selected CONFIRMATION or LEADING indicator does not generate signal on candle close, it will be indicated with cross symbol ✖.
how to use this indicator
==============================
Using the indicator is pretty simple, but it depends on your goal, whether you want to use it for overlaying the available indicators or using it to build your strategy or for both.
To use for Building your strategy: Select your LEADING INDICATOR, and then select your CONFIRMATION INDICATOR(s). if on candle close all the indicators generate signal, then this indicator will print SHORT or LONG signal on the chart for your entry. There are plenty of indicators you can use to build your strategy, some indicators are best for longer time frame setups while others are responsive indicators that are best for short time frame.
To use for overlaying the indicators: Open the setting of this indicator and scroll to the SWITCHBOARD section, from there you can select which indicator you want to plot on the chart.
For each of the listed indicators, you have the flexibility to customize the settings and configurations to suit your preferences. simply open indicator setting and scroll down, you will find configuration for each of the indicators used.
I will also release the Strategy Backtester for this indicator soon.
Encapsulation BoxThe “Encapsulation Box” indicator is designed to locate areas of the chart where the highs and lows of candlesticks are “embedded” or enclosed within the body of a previous candlestick. This setup indicates a significant contraction in the market and can provide important trading signals. Here's how it works in more detail:
Detecting contraction: The indicator looks for situations where the price range of the candles is very narrow, i.e. when subsequent candles have highs and lows that are contained within the range of a previous candle. This condition indicates a contraction in the market before a possible directional move.
When a contraction is detected, the indicator draws a rectangle around the area where the highs and lows of the candles are embedded. The rectangle has its upper vertex corresponding to the maximum of the candles involved and its lower vertex corresponding to the minimum. The width of the rectangle is defined by can be customized by the user.
A key feature of this indicator is the horizontal line drawn outside the rectangle. This line is positioned in the middle of the rectangle and represents 50% of the range of the rectangle itself. This line acts as a significant support or resistance level depending on the direction the contraction breaks.
The indicator can generate buy or sell signals when a break in the rectangle or horizontal line occurs. For example, if the price breaks above the rectangle and the horizontal line, it could generate a buy signal, indicating a possible uptrend. Conversely, if the price breaks below the rectangle and the horizontal line, it could generate a sell signal, indicating a possible downtrend.
Contraction Box & Doji LinesContraction & Doji Lines indicator is designed to identify and visualize potential support and resistance levels on a price chart. It does this by detecting doji candlestick patterns and drawing horizontal lines from the middle of the doji bodies to the right. Additionally, it also highlights price contraction zones with colored boxes.
The indicator first identifies doji candlestick patterns that it suggests indecision in the market, a horizontal line and these horizontal lines can act as potential support or resistance levels. Traders can observe price reactions around these lines. If the price approaches a line and bounces off it, it may indicate a significant level in the market.
In addition to doji lines, this indicator also highlights price contraction zones. When a contraction zone is detected, a colored box is drawn to highlight this zone. The box extends from the fifth bar ago (left side) to the current bar (right side), with the highest high and lowest low of the identified zone. The color and width of this box can be customized using the "Box Line Border Color," "Box Background Color," and "Box Width" parameters.
A possible strategy could be can use the doji lines as potential support and resistance levels to make trading decisions. For example, if the price breaks above a doji line and holds, it may indicate a bullish signal.
The colored boxes highlight areas of price contraction, which often precede significant price movements. Traders can use these zones to anticipate potential breakouts or breakdowns.
For example, you might enter a long (buy) position if it anticipate a breakout from a contraction zone with a target price set above the breakout level. Conversely, you might enter a short (sell) position if they anticipate a breakdown from a contraction zone with a target price set below the breakdown level.
Supply and Demand Anchored [LuxAlgo]The Supply and Demand Anchored indicator is an anchored version of the popular Supply and Demand Visible Range indicator. Once adding the indicator to the chart, users need to manually select the starting and ending points for the indicator's calculation. The estimated supply/demand zones are then extended.
🔶 USAGE
The proposed indicator makes use of the same method highlighted in previous posts (see related scripts section below) to estimate supply and demand zones.
When adding the indicator to the chart, users will be prompted to select a starting and ending point for the calculation of the supply and demand zones, click on your chart to select those points.
Once calculated, each zone/level will be extended to the right of the chart. These can be used as support/resistance zones. Clicking on one of the graphical elements of the indicator or the indicator title will highlight the starting and ending calculation points, these can be dragged to be set at different locations.
🔶 SETTINGS
Threshold %: Percentage of the total visible range volume used as a threshold to set supply/demand areas. Higher values return wider areas.
Resolution: Determines the number of bins used to find each area. Higher values will return more precise results.
Intra-bar TF: Timeframe used to obtain intra-bar data.
🔶 RELATED SCRIPTS
EMA x 3 MAsThis indicator can be used for moving average strategies based on a EMA trigger over MAs (SMAs) : MA1 , MA2 , MA3 .
Based on those crossings, the background color will change for the upcoming candle showing green for upper crossing change (the more MA are crossed, the darker is the background). Order and priority of background colors :
1/ EMA x MA1
2/ EMA x MA2 (if EMA x MA1 confirmed)
3/ EMA x MA3 (if EMA x MA1and EMA x MA2 confirmed)
EMA and MAs can also be tuned with your own values in the parameters, therefore allowing you to try different strategies and to use the EMA and MAs as support/resistance indication.
You can set up the background and lines colors in the Style in the parameters.
Support & Resistance PROHi Traders!
The Support & Resistance PRO
A simple and effective indicator that helped me a bunch!
This indicator will chart simple support and resistance zones on 2 time frames of your choice.
It uses a 30 day lookback period and will find the last high and low.
Each zone is built from the highest/lowest closure, and the highest/lowest wick, creating a liquid zone between the 2.
It is perfect for people trading support and resistance, watching key areas, scalping zones and much more!
*You can change the time frames you are looking at and the lookback period.
*The example in the picture is looking at the Daily and Weekly zones on BTC.
Liquidity Sentiment Profile (Auto-Anchored) [LuxAlgo]
The Liquidity Sentiment Profile (Auto-Anchored) is an advanced charting tool that measures by combining PRICE and VOLUME data over specified anchored periods and highlights the distribution of the liquidity and the market sentiment at specific price levels. This version is a variation of the previously published Liquidity Sentiment Profile , wherewith this version allows users to select a variety of different anchoring periods, such as 'Auto', 'Fixed Range', 'Swing High', 'Swing Low', 'Session', 'Day', 'Week', 'Month', 'Quarter', and 'Year'
Liquidity refers to the availability of orders at specific price levels in the market, allowing transactions to occur smoothly.
🔶 USAGE
A Liquidity Sentiment Profile (Auto-Anchored) is a combination of liquidity and a sentiment profile, where the right side of the profile highlights the distribution of the traded activity at different price levels, and the left side of the profile highlights the market sentiment at those price levels
The liquidity profile is categorized by assigning different colors based on the significance of the traded activity of the specific price levels, allowing traders to reveal significant price levels, such as support and resistance levels, supply and demand zones, liquidity gaps, consolidation zones, etc
The Liquidity Sentiment Profiles aim to present Value Areas based on the significance of price levels, thus allowing users to identify value areas that can be formed more than once within the range of a single profile
Level of Significance Line - displays the changes in the price levels with the highest traded activity (developing POC)
Buyside & Sellside Liquidity Zones - displays Liquidity Levels, also known as Supply and Demand Zones
🔶 SETTINGS
The script takes into account user-defined parameters and plots the profiles, where detailed usage for each user-defined input parameter in indicator settings is provided with the related input's tooltip.
🔹 Liquidity Sentiment Profile
Anchor Period: The indicator resolution is set by the input of the Anchor Period.
Fixed Period: Applicable if the Anchor Period is set to 'Fixed Range' then the period of the profile is defined with this option
Swing Detection Length: Applicable if the Anchor Period is set to 'Swing High' or 'Swing Low' then the length required to detect the Swing Levels is defined with this option which is then used to determine the period of the profile
🔹 Liquidity Profile
Liquidity Profile: Toggles the visibility of the Liquidity Profiles
High Traded Nodes: Threshold and Color option for High Traded Nodes
Average Traded Nodes: Color option for Average Traded Nodes
Low Traded Nodes: Threshold and Color option for Low Traded Nodes
🔹 Sentiment Profile
Sentiment Profile: Toggles the visibility of the Sentiment Profiles
Bullish Nodes: Color option for Bullish Nodes
Bearish Nodes: Color option for Bearish Nodes
🔹 Buyside & Sellside Liquidity Zones
Buyside & Sellside Liquidity Zones: Toggles the visibility of the Liquidity Levels
Buyside Liquidity Nodes: Color option for Buyside Liquidity Nodes
Sellside Liquidity Nodes: Color option for Sellside Liquidity Nodes
🔹 Other Settings
Level of Significance: Toggles the visibility of the Level of Significance Line
Price Levels, Color: Toggles the visibility of the Profile Price Levels
Number of Rows: Specify how many rows each profile histogram will have. Caution, having it set to high values will quickly hit Pine Script™ drawing objects limit and fewer historical profiles will be displayed
Profile Width %: Alters the width of the rows in the histogram, relative to the profile length
Profile Range Background Fill: Toggles the visibility of the Profiles Range
🔶 RELATED SCRIPTS
Liquidity-Sentiment-Profile
Buyside-Sellside-Liquidity
ICT-Concepts
Bollinger Bands Liquidity Cloud [ChartPrime]This indicator overlays a heatmap on the price chart, providing a detailed representation of Bollinger bands' profile. It offers insights into the price's behavior relative to these bands. There are two visualization styles to choose from: the Volume Profile and the Z-Score method.
Features
Volume Profile: This method illustrates how the price interacts with the Bollinger bands based on the traded volume.
Z-Score: In this mode, the indicator samples the real distribution of Z-Scores within a specified window and rescales this distribution to the desired sample size. It then maps the distribution as a heatmap by calculating the corresponding price for each Z-Score sample and representing its weight via color and transparency.
Parameters
Length: The period for the simple moving average that forms the base for the Bollinger bands.
Multiplier: The number of standard deviations from the moving average to plot the upper and lower Bollinger bands.
Main:
Style: Choose between "Volume" and "Z-Score" visual styles.
Sample Size: The size of the bin. Affects the granularity of the heatmap.
Window Size: The lookback window for calculating the heatmap. When set to Z-Score, a value of `0` implies using all available data. It's advisable to either use `0` or the highest practical value when using the Z-Score method.
Lookback: The amount of historical data you want the heatmap to represent on the chart.
Smoothing: Implements sinc smoothing to the distribution. It smoothens out the heatmap to provide a clearer visual representation.
Heat Map Alpha: Controls the transparency of the heatmap. A higher value makes it more opaque, while a lower value makes it more transparent.
Weight Score Overlay: A toggle that, when enabled, displays a letter score (`S`, `A`, `B`, `C`, `D`) inside the heatmap boxes, based on the weight of each data point. The scoring system categorizes each weight into one of these letters using the provided percentile ranks and the median.
Color
Color: Color for high values.
Standard Deviation Color: Color to represent the standard deviation on the Bollinger bands.
Text Color: Determines the color of the letter score inside the heatmap boxes. Adjusting this parameter ensures that the score is visible against the heatmap color.
Usage
Once this indicator is applied to your chart, the heatmap will be overlaid on the price chart, providing a visual representation of the price's behavior in relation to the Bollinger bands. The intensity of the heatmap is directly tied to the price action's intensity, defined by your chosen parameters.
When employing the Volume Profile style, a brighter and more intense area on the heatmap indicates a higher trading volume within that specific price range. On the other hand, if you opt for the Z-Score method, the intensity of the heatmap reflects the Z-Score distribution. Here, a stronger intensity is synonymous with a more frequent occurrence of a specific Z-Score.
For those seeking an added layer of granularity, there's the "Weight Score Overlay" feature. When activated, each box in your heatmap will sport a letter score, ranging from `S` to `D`. This score categorizes the weight of each data point, offering a concise breakdown:
- `S`: Data points with a weight of 1.
- `A`: Weights below 1 but greater than or equal to the 75th percentile rank.
- `B`: Weights under the 75th percentile but at or above the median.
- `C`: Weights beneath the median but surpassing the 25th percentile rank.
- `D`: All that fall below the 25th percentile rank.
This scoring feature augments the heatmap's visual data, facilitating a quicker interpretation of the weight distribution across the dataset.
Further Explanations
Volume Profile
A volume profile is a tool used by traders to visualize the amount of trading volume occurring at specific price levels. This kind of profile provides a deep insight into the market's structure and helps traders identify key areas of support and resistance, based on where the most trading activity took place. The concept behind the volume profile is that the amount of volume at each price level can indicate the potential importance of that price.
In this indicator:
- The volume profile mode creates a visual representation by sampling trading volumes across price levels.
- The representation displays the balance between bullish and bearish volumes at each level, which is further differentiated using a color gradient from `low_color` to `high_color`.
- The volume profile becomes more refined with sinc smoothing, helping to produce a smoother distribution of volumes.
Z-Score and Distribution Resampling
Z-Score, in the context of trading, represents the number of standard deviations a data point (e.g., closing price) is from the mean (average). It’s a measure of how unusual or typical a particular data point is in relation to all the data. In simpler terms, a high Z-Score indicates that the data point is far away from the mean, while a low Z-Score suggests it's close to the mean.
The unique feature of this indicator is that it samples the real distribution of z-scores within a window and then resamples this distribution to fit the desired sample size. This process is termed as "resampling in the context of distribution sampling" . Resampling provides a way to reconstruct and potentially simplify the original distribution of z-scores, making it easier for traders to interpret.
In this indicator:
- Each Z-Score corresponds to a price value on the chart.
- The resampled distribution is then used to display the heatmap, with each Z-Score related price level getting a heatmap box. The weight (or importance) of each box is represented as a combination of color and transparency.
How to Interpret the Z-Score Distribution Visualization:
When interpreting the Z-Score distribution through color and alpha in the visualization, it's vital to understand that you're seeing a representation of how unusual or typical certain data points are without directly viewing the numerical Z-Score values. Here's how you can interpret it:
Intensity of Color: This often corresponds to the distance a particular data point is from the mean.
Lighter shades (closer to `low_color`) typically indicate data points that are more extreme, suggesting overbought or oversold conditions. These could signify potential reversals or significant deviations from the norm.
Darker shades (closer to `high_color`) represent data points closer to the mean, suggesting that the price is relatively typical compared to the historical data within the given window.
Alpha (Transparency): The degree of transparency can indicate the significance or confidence of the observed deviation. More opaque boxes might suggest a stronger or more reliable deviation from the mean, implying that the observed behavior is less likely to be a random occurrence.
More transparent boxes could denote less certainty or a weaker deviation, meaning that the observed price behavior might not be as noteworthy.
- Combining Color and Alpha: By observing both the intensity of color and the level of transparency, you get a richer understanding. For example:
- A light, opaque box could suggest a strong, significant deviation from the mean, potentially signaling an overbought or oversold scenario.
- A dark, transparent box might indicate a weak, insignificant deviation, suggesting the price is behaving typically and is close to its average.
Grid by Volatility (Expo)█ Overview
The Grid by Volatility is designed to provide a dynamic grid overlay on your price chart. This grid is calculated based on the volatility and adjusts in real-time as market conditions change. The indicator uses Standard Deviation to determine volatility and is useful for traders looking to understand price volatility patterns, determine potential support and resistance levels, or validate other trading signals.
█ How It Works
The indicator initiates its computations by assessing the market volatility through an established statistical model: the Standard Deviation. Following the volatility determination, the algorithm calculates a central equilibrium line—commonly referred to as the "mid-line"—on the chart to serve as a baseline for additional computations. Subsequently, upper and lower grid lines are algorithmically generated and plotted equidistantly from the central mid-line, with the distance being dictated by the previously calculated volatility metrics.
█ How to Use
Trend Analysis: The grid can be used to analyze the underlying trend of the asset. For example, if the price is above the Average Line and moves toward the Upper Range, it indicates a strong bullish trend.
Support and Resistance: The grid lines can act as dynamic support and resistance levels. Price tends to bounce off these levels or breakthrough, providing potential trade opportunities.
Volatility Gauge: The distance between the grid lines serves as a measure of market volatility. Wider lines indicate higher volatility, while narrower lines suggest low volatility.
█ Settings
Volatility Length: Number of bars to calculate the Standard Deviation (Default: 200)
Squeeze Adjustment: Multiplier for the Standard Deviation (Default: 6)
Grid Confirmation Length: Number of bars to calculate the weighted moving average for smoothing the grid lines (Default: 2)
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
Linear Regression IndicatorThis tool can be used to determine the direction of the current trend.
The indicator changes the color of the candles based on the direction of the linear regression formula. This is made settings the length of the short-term linear regression in the settings, the longer one is also based on that parameter but significantly larger.
The indicator also plots the average between the two linear regression lines used in the candle coloring formula, and can be used both for support and resistance or as a trend line used to analyze breakouts.
Support and Resistance Signals MTF [LuxAlgo]The Support and Resistance Signals MTF indicator aims to identify undoubtedly one of the key concepts of technical analysis Support and Resistance Levels and more importantly, the script aims to capture and highlight major price action movements, such as Breakouts , Tests of the Zones , Retests of the Zones , and Rejections .
The script supports Multi-TimeFrame (MTF) functionality allowing users to analyze and observe the Support and Resistance Levels/Zones and their associated Signals from a higher timeframe perspective.
This script is an extended version of our previously published Support-and-Resistance-Levels-with-Breaks script from 2020.
Identification of key support and resistance levels/zones is an essential ingredient to successful technical analysis.
🔶 USAGE
Support and resistance are key concepts that help traders understand, analyze and act on chart patterns in the financial markets. Support describes a price level where a downtrend pauses due to demand for an asset increasing, while resistance refers to a level where an uptrend reverses as a sell-off happens.
The creation of support and resistance levels comes as a result of an initial imbalance of supply/demand, which forms what we know as a swing high or swing low. This script starts its processing using the swing highs/lows. Swing Highs/Lows are levels that many of the market participants use as a historical reference to place their trading orders (buy, sell, stop loss), as a result, those price levels potentially become and serve as key support and resistance levels.
One of the important features of the script is the signals it provides. The script follows the major price movements and highlights them on the chart.
🔹 Breakouts (non-repaint)
A breakout is a price moving outside a defined support or resistance level, the significance of the breakout can be measured by examining the volume. This script is not filtering them based on volume but provides volume information for the bar where the breakout takes place.
🔹 Retests
Retest is a case where the price action breaches a zone and then revisits the level breached.
🔹 Tests
Test is a case where the price action touches the support or resistance zones.
🔹 Rejections
Rejections are pin bar patterns with high trading volume.
Finally, Multi TimeFrame (MTF) functionality allows users to analyze and observe the Support and Resistance Levels/Zones and their associated Signals from a higher timeframe perspective.
🔶 SETTINGS
The script takes into account user-defined parameters to detect and highlight the zones, levels, and signals.
🔹 Support & Resistance Settings
Detection Timeframe: Set the indicator resolution, the users may examine higher timeframe detection on their chart timeframe.
Detection Length: Swing levels detection length
Check Previous Historical S&R Level: enables the script to check the previous historical levels.
🔹 Signals
Breakouts: Toggles the visibility of the Breakouts, enables customization of the color and the size of the visuals
Tests: Toggles the visibility of the Tests, enables customization of the color and the size of the visuals
Retests: Toggles the visibility of the Retests, enables customization of the color and the size of the visuals
Rejections: Toggles the visibility of the Rejections, enables customization of the color and the size of the visuals
🔹 Others
Sentiment Profile: Toggles the visibility of the Sentiment Profiles
Bullish Nodes: Color option for Bullish Nodes
Bearish Nodes: Color option for Bearish Nodes
🔶 RELATED SCRIPTS
Support-and-Resistance-Levels-with-Breaks
Buyside-Sellside-Liquidity
Liquidity-Levels-Voids
Support and Resistance Levels and Zones [Quantigenics]Support and Resistance Levels and Zones Indicator is an enhanced support and resistance indicator in that typical support and resistance levels are crucial concepts in technical analysis representing price levels where selling or buying momentum tends to halt, typically leading to a price reversal.
The Support and Resistance Levels and Zones Indicator goes beyond static levels by identifying dynamic 'zones'. These zones, depicted as shaded areas, offer more nuanced insights, acknowledging that markets are not rigid but fluctuating entities. Traders can leverage these zones, alongside the standard levels that the indicator plots, to better time their entries and exits, maximizing potential profitability and minimizing risk.
This is a "must-see on your charts" indicator and while scrolling back looking at historical data shows the amazing power of this indicator, it's even better in realtime LIVE price action and the price can tend to hit the Support and Resistance Levels and Zones multiple times intrabar.
TVC:GOLD 1HR
NYMEX:CL1! 15MIN
Enjoy!
Support and Resistance Oscillator [CC]The Support and Resistance Oscillator is an experimental script I created to identify when the current price breaks a support or resistance line and reflect this value in an oscillator formula. This indicator uses a threshold to decide the dividing line between buying and selling points. Feel free to change the threshold or smoothing settings to see if you find anything better since this is so experimental. I'm double smoothing the difference between the indicator and its signal line to attempt to capture a combo of the price momentum combined with the general support and resistance levels. I have used dark colors for strong signals and lighter colors for normal signals and make sure to buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts or indicators you would like to see me publish!
Machine Learning Regression Trend [LuxAlgo]The Machine Learning Regression Trend tool uses random sample consensus (RANSAC) to fit and extrapolate a linear model by discarding potential outliers, resulting in a more robust fit.
🔶 USAGE
The proposed tool can be used like a regular linear regression, providing support/resistance as well as forecasting an estimated underlying trend.
Using RANSAC allows filtering out outliers from the input data of our final fit, by outliers we are referring to values deviating from the underlying trend whose influence on a fitted model is undesired. For financial prices and under the assumptions of segmented linear trends, these outliers can be caused by volatile moves and/or periodic variations within an underlying trend.
Adjusting the "Allowed Error" numerical setting will determine how sensitive the model is to outliers, with higher values returning a more sensitive model. The blue margin displayed shows the allowed error area.
The number of outliers in the calculation window (represented by red dots) can also be indicative of the amount of noise added to an underlying linear trend in the price, with more outliers suggesting more noise.
Compared to a regular linear regression which does not discriminate against any point in the calculation window, we see that the model using RANSAC is more conservative, giving more importance to detecting a higher number of inliners.
🔶 DETAILS
RANSAC is a general approach to fitting more robust models in the presence of outliers in a dataset and as such does not limit itself to a linear regression model.
This iterative approach can be summarized as follow for the case of our script:
Step 1: Obtain a subset of our dataset by randomly selecting 2 unique samples
Step 2: Fit a linear regression to our subset
Step 3: Get the error between the value within our dataset and the fitted model at time t , if the absolute error is lower than our tolerance threshold then that value is an inlier
Step 4: If the amount of detected inliers is greater than a user-set amount save the model
Repeat steps 1 to 4 until the set number of iterations is reached and use the model that maximizes the number of inliers
🔶 SETTINGS
Length: Calculation window of the linear regression.
Width: Linear regression channel width.
Source: Input data for the linear regression calculation.
🔹 RANSAC
Minimum Inliers: Minimum number of inliers required to return an appropriate model.
Allowed Error: Determine the tolerance threshold used to detect potential inliers. "Auto" will automatically determine the tolerance threshold and will allow the user to multiply it through the numerical input setting at the side. "Fixed" will use the user-set value as the tolerance threshold.
Maximum Iterations Steps: Maximum number of allowed iterations.
Smart Money Range [ChartPrime]The Smart Money Range indicator is designed to provide traders with a holistic view of market structure, emphasizing potential key support and resistance levels within a predefined range. This indicator is not just a visually pleasing, but also a comprehensive guide to understanding the market’s dynamics at a given level.
Key Features:
Defined Range: The indicator demarcates a clear range, highlighting support and resistance levels within it. This aids in identifying potential areas of buying and selling pressure. These are derived from highly significant areas that have been touched many times before.
Touches Counter: Underneath the support and resistance lines, there are numerical values that show the number of times price has interacted with these levels. This can provide insights into the strength or weakness of a particular level.
Zig-Zag Projections: Within the range, there's a zig-zag pattern indicating possible future touches, helping traders anticipate future price movements.
Double-Sided Profile: To the right of the range, a dual-profile is showcased. One side of the profile displays the volume traded at specific price levels, giving insights into where significant buying or selling has occurred. On the other side, it reflects the number of touches at that given price level, reinforcing the importance of particular price points.
Customizability: Users have the option to adjust the period setting, allowing them to cater the indicator to their specific trading style and configuration. Additionally, with volume levels settings, traders can adjust the number of bins in the profile for a tailored view.
Parabolic SAR ZoneThe Parabolic SAR Zone indicator is a tool designed to help traders identify the best zone to enter in a position revisiting the usage of the standard Parabolic SAR indicator.
In the settings you can choose all the parameters of the standard indicator, and in addition to that you can also change the multiplier for the zone width.
This indicator provides two different Parabolic SAR indicators, the first one has the settings that you chose and displays the zone, meanwhile, the second one has half the parameters you have chosen and can be used to determine the long-term trend direction.
SuperTrend ZoneThe SuperTrend Zone indicator is a tool designed to help traders identify the best zone to enter in a position revisiting the usage of the standard SuperTrend indicator.
In the settings you can chose the ATR length and the Factor of the indicator, and in addition to that you can also change the multiplier for the zone width.
This indicator provide two different SuperTrend indicator, the first one has the settings that you chose and display the zone, meanwhile the second one has double the parameters you have chosen and can be used to determine the long term trend direction.
Support & Resistance AI (K means/median) [ThinkLogicAI]█ OVERVIEW
K-means is a clustering algorithm commonly used in machine learning to group data points into distinct clusters based on their similarities. While K-means is not typically used directly for identifying support and resistance levels in financial markets, it can serve as a tool in a broader analysis approach.
Support and resistance levels are price levels in financial markets where the price tends to react or reverse. Support is a level where the price tends to stop falling and might start to rise, while resistance is a level where the price tends to stop rising and might start to fall. Traders and analysts often look for these levels as they can provide insights into potential price movements and trading opportunities.
█ BACKGROUND
The K-means algorithm has been around since the late 1950s, making it more than six decades old. The algorithm was introduced by Stuart Lloyd in his 1957 research paper "Least squares quantization in PCM" for telecommunications applications. However, it wasn't widely known or recognized until James MacQueen's 1967 paper "Some Methods for Classification and Analysis of Multivariate Observations," where he formalized the algorithm and referred to it as the "K-means" clustering method.
So, while K-means has been around for a considerable amount of time, it continues to be a widely used and influential algorithm in the fields of machine learning, data analysis, and pattern recognition due to its simplicity and effectiveness in clustering tasks.
█ COMPARE AND CONTRAST SUPPORT AND RESISTANCE METHODS
1) K-means Approach:
Cluster Formation: After applying the K-means algorithm to historical price change data and visualizing the resulting clusters, traders can identify distinct regions on the price chart where clusters are formed. Each cluster represents a group of similar price change patterns.
Cluster Analysis: Analyze the clusters to identify areas where clusters tend to form. These areas might correspond to regions of price behavior that repeat over time and could be indicative of support and resistance levels.
Potential Support and Resistance Levels: Based on the identified areas of cluster formation, traders can consider these regions as potential support and resistance levels. A cluster forming at a specific price level could suggest that this level has been historically significant, causing similar price behavior in the past.
Cluster Standard Deviation: In addition to looking at the means (centroids) of the clusters, traders can also calculate the standard deviation of price changes within each cluster. Standard deviation is a measure of the dispersion or volatility of data points around the mean. A higher standard deviation indicates greater price volatility within a cluster.
Low Standard Deviation: If a cluster has a low standard deviation, it suggests that prices within that cluster are relatively stable and less likely to exhibit sudden and large price movements. Traders might consider placing tighter stop-loss orders for trades within these clusters.
High Standard Deviation: Conversely, if a cluster has a high standard deviation, it indicates greater price volatility within that cluster. Traders might opt for wider stop-loss orders to allow for potential price fluctuations without getting stopped out prematurely.
Cluster Density: Each data point is assigned to a cluster so a cluster that is more dense will act more like gravity and
2) Traditional Approach:
Trendlines: Draw trendlines connecting significant highs or lows on a price chart to identify potential support and resistance levels.
Chart Patterns: Identify chart patterns like double tops, double bottoms, head and shoulders, and triangles that often indicate potential reversal points.
Moving Averages: Use moving averages to identify levels where the price might find support or resistance based on the average price over a specific period.
Psychological Levels: Identify round numbers or levels that traders often pay attention to, which can act as support and resistance.
Previous Highs and Lows: Identify significant previous price highs and lows that might act as support or resistance.
The key difference lies in the approach and the foundation of these methods. Traditional methods are based on well-established principles of technical analysis and market psychology, while the K-means approach involves clustering price behavior without necessarily incorporating market sentiment or specific price patterns.
It's important to note that while the K-means approach might provide an interesting way to analyze price data, it should be used cautiously and in conjunction with other traditional methods. Financial markets are influenced by a wide range of factors beyond just price behavior, and the effectiveness of any method for identifying support and resistance levels should be thoroughly tested and validated. Additionally, developments in trading strategies and analysis techniques could have occurred since my last update.
█ K MEANS ALGORITHM
The algorithm for K means is as follows:
Initialize cluster centers
assign data to clusters based on minimum distance
calculate cluster center by taking the average or median of the clusters
repeat steps 1-3 until cluster centers stop moving
█ LIMITATIONS OF K MEANS
There are 3 main limitations of this algorithm:
Sensitive to Initializations: K-means is sensitive to the initial placement of centroids. Different initializations can lead to different cluster assignments and final results.
Assumption of Equal Sizes and Variances: K-means assumes that clusters have roughly equal sizes and spherical shapes. This may not hold true for all types of data. It can struggle with identifying clusters with uneven densities, sizes, or shapes.
Impact of Outliers: K-means is sensitive to outliers, as a single outlier can significantly affect the position of cluster centroids. Outliers can lead to the creation of spurious clusters or distortion of the true cluster structure.
█ LIMITATIONS IN APPLICATION OF K MEANS IN TRADING
Trading data often exhibits characteristics that can pose challenges when applying indicators and analysis techniques. Here's how the limitations of outliers, varying scales, and unequal variance can impact the use of indicators in trading:
Outliers are data points that significantly deviate from the rest of the dataset. In trading, outliers can represent extreme price movements caused by rare events, news, or market anomalies. Outliers can have a significant impact on trading indicators and analyses:
Indicator Distortion: Outliers can skew the calculations of indicators, leading to misleading signals. For instance, a single extreme price spike could cause indicators like moving averages or RSI (Relative Strength Index) to give false signals.
Risk Management: Outliers can lead to overly aggressive trading decisions if not properly accounted for. Ignoring outliers might result in unexpected losses or missed opportunities to adjust trading strategies.
Different Scales: Trading data often includes multiple indicators with varying units and scales. For example, prices are typically in dollars, volume in units traded, and oscillators have their own scale. Mixing indicators with different scales can complicate analysis:
Normalization: Indicators on different scales need to be normalized or standardized to ensure they contribute equally to the analysis. Failure to do so can lead to one indicator dominating the analysis due to its larger magnitude.
Comparability: Without normalization, it's challenging to directly compare the significance of indicators. Some indicators might have a larger numerical range and could overshadow others.
Unequal Variance: Unequal variance in trading data refers to the fact that some indicators might exhibit higher volatility than others. This can impact the interpretation of signals and the performance of trading strategies:
Volatility Adjustment: When combining indicators with varying volatility, it's essential to adjust for their relative volatilities. Failure to do so might lead to overemphasizing or underestimating the importance of certain indicators in the trading strategy.
Risk Assessment: Unequal variance can impact risk assessment. Indicators with higher volatility might lead to riskier trading decisions if not properly taken into account.
█ APPLICATION OF THIS INDICATOR
This indicator can be used in 2 ways:
1) Make a directional trade:
If a trader thinks price will go higher or lower and price is within a cluster zone, The trader can take a position and place a stop on the 1 sd band around the cluster. As one can see below, the trader can go long the green arrow and place a stop on the one standard deviation mark for that cluster below it at the red arrow. using this we can calculate a risk to reward ratio.
Calculating risk to reward: targeting a risk reward ratio of 2:1, the trader could clearly make that given that the next resistance area above that in the orange cluster exceeds this risk reward ratio.
2) Take a reversal Trade:
We can use cluster centers (support and resistance levels) to go in the opposite direction that price is currently moving in hopes of price forming a pivot and reversing off this level.
Similar to the directional trade, we can use the standard deviation of the cluster to place a stop just in case we are wrong.
In this example below we can see that shorting on the red arrow and placing a stop at the one standard deviation above this cluster would give us a profitable trade with minimal risk.
Using the cluster density table in the upper right informs the trader just how dense the cluster is. Higher density clusters will give a higher likelihood of a pivot forming at these levels and price being rejected and switching direction with a larger move.
█ FEATURES & SETTINGS
General Settings:
Number of clusters: The user can select from 3 to five clusters. A good rule of thumb is that if you are trading intraday, less is more (Think 3 rather than 5). For daily 4 to 5 clusters is good.
Cluster Method: To get around the outlier limitation of k means clustering, The median was added. This gives the user the ability to choose either k means or k median clustering. K means is the preferred method if the user things there are no large outliers, and if there appears to be large outliers or it is assumed there are then K medians is preferred.
Bars back To train on: This will be the amount of bars to include in the clustering. This number is important so that the user includes bars that are recent but not so far back that they are out of the scope of where price can be. For example the last 2 years we have been in a range on the sp500 so 505 days in this setting would be more relevant than say looking back 5 years ago because price would have to move far to get there.
Show SD Bands: Select this to show the 1 standard deviation bands around the support and resistance level or unselect this to just show the support and resistance level by itself.
Features:
Besides the support and resistance levels and standard deviation bands, this indicator gives a table in the upper right hand corner to show the density of each cluster (support and resistance level) and is color coded to the cluster line on the chart. Higher density clusters mean price has been there previously more than lower density clusters and could mean a higher likelihood of a reversal when price reaches these areas.
█ WORKS CITED
Victor Sim, "Using K-means Clustering to Create Support and Resistance", 2020, towardsdatascience.com
Chris Piech, "K means", stanford.edu
█ ACKNOLWEDGMENTS
@jdehorty- Thanks for the publish template. It made organizing my thoughts and work alot easier.