Nifty 50 5mint Strategy
The script defines a specific trading session based on user inputs. This session is specified by a time range (e.g., "1000-1510") and selected days of the week (e.g., Monday to Friday). This session definition is crucial for trading only during specific times.
Lookback and Breakout Conditions:
The script uses a lookback period and the highest high and lowest low values to determine potential breakout points. The lookback period is user-defined (default is 10 periods).
The script also uses Bollinger Bands (BB) to identify potential breakout conditions. Users can enable or disable BB crossover conditions. BB consists of an upper and lower band, with the basis.
Additionally, the script uses Dema (Double Exponential Moving Average) and VWAP (Volume Weighted Average Price) . Users can enable or disable this condition.
Buy and Sell Conditions:
Buy conditions are met when the close price exceeds the highest high within the specified lookback period, Bollinger Bands conditions are satisfied, Dema-VWAP conditions are met, and the script is within the defined trading session.
Sell conditions are met when the close price falls below the lowest low within the lookback period, Bollinger Bands conditions are satisfied, Dema-VWAP conditions are met, and the script is within the defined trading session.
When either condition is met, it triggers a "long" or "short" position entry.
Trailing Stop Loss (TSL):
Users can choose between fixed points ( SL by points ) or trailing stop (Profit Trail).
For fixed points, users specify the number of points for the stop loss. A fixed stop loss is set at a certain distance from the entry price if a position is opened.
For Profit Trail, users can enable or disable this feature. If enabled, the script uses a "trail factor" (lookback period) to determine when to adjust the stop loss.
If the price moves in the direction of the trade and reaches a certain level (determined by the trail factor), the stop loss is adjusted, trailing behind the price to lock in profits.
If the close price falls below a certain level (lowest low within the trail factor(lookback)), and a position is open, the "long" position is closed (strategy.close("long")).
If the close price exceeds a certain level (highest high within the specified trail factor(lookback)), and a position is open, the "short" position is closed (strategy.close("short")).
Positions are also closed if they are open outside of the defined trading session.
Background Color:
The script changes the background color of the chart to indicate buy (green) and sell (red) signals, making it visually clear when the strategy conditions are met.
In summary, this script implements a breakout trading strategy with various customizable conditions, including Bollinger Bands, Dema-VWAP crossovers, and session-specific rules. It also includes options for setting stop losses and trailing stop losses to manage risk and lock in profits. The "trail factor" helps adjust trailing stops dynamically based on recent price movements. Positions are closed under certain conditions to manage risk and ensure compliance with the defined trading session.
CE=Buy, CE_SL=stoploss_buy, tCsl=Trailing Stop_buy.
PE=sell, PE_SL= stoploss_sell, tpsl=Trailing Stop_sell.
Remember that trading involves inherent risks, and past performance is not indicative of future results. Exercise caution, manage risk diligently, and consider the advice of financial experts when using this script or any trading strategy.
Hỗ trợ và kháng cự
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.
Heeger Alert | Didi's Needles setup [HeegerBot]Indicator based on Color Candles - Didi's Needles setup , but now exclusively focused on generating alerts.
With this indicator, you can set up alerts and notifications on TradingView for up to 15 assets based on Didi Aguiar's setup. Additionally, you can specify whether the alert should trigger at the candle close or X minutes before the close.
A session filter has also been added, allowing you to configure alerts to trigger only during a specific session.
Description of monitored signals:
The setup involves the crossing of three moving averages, along with the trend analysis in the ADX and the open Bollinger Bands.
The moving averages will be named "Didi Index". We will have the 3-period average as "Fast Average", the 8-period average as "Median Average", and the 20-period average as "Slow Average". When the Fast Average crosses the Median Average, we will have an alert, and when the Slow Average crosses the Median Average, we will have a confirmation. To adjust the Didi Index in the signals, the Median Average was normalized, that is, it will always be equal to 0. For the Slow and Fast Average, we will only consider the percentage difference in relation to the Median Average.
In addition to the moving averages, we analyze whether the ADX is rising, with DI+ above DI- to indicate an uptrend, or if the ADX is rising, with DI- above DI+ to indicate a downtrend. We also check if the Bollinger Bands are open. With these conditions, we will have a Needle.
Now I'm going to detail how I set this up on the indicator and some filters that I inserted for my personal use, along with some additional signals from the setup.
# Needle Alert
Firstly, we have the "Needle Alert" signal. This signal occurs when the Fast Average crosses the Median Average, along with the trend confirmation in the ADX and the opening of the Bollinger Bands. The filter is set at "1", which means we will only consider the needle alert when the percentage difference between the Slow Average and the Median Average is below 1%. This signal can be used as an entry point or to monitor the asset. Let's go through the examples:
• For a "Buy Alert", the Fast Average must cross the Median Average from bottom to top, and the percentage difference between the Slow Average and the Median Average should be less than +1% and greater than 0, as indicated by the Didi Index.
• For a "Sell Alert", the Fast Average must cross the Median Average from top to bottom, and the percentage difference between the Slow Average and the Median Average should be greater than -1% and less than 0, as indicated by the Didi Index.
We also have the alert projection, which serves as a signal to attract attention and monitor the asset. I use a "0.1" filter, which means that the percentage difference between the Fast Average and the Median Average must be equal to or less than 0.1%. Let's look at the example:
• For a "Buy Alert Projection", the Fast Average should be below the Median Average, and the percentage difference between the Fast Average and the Median Average should be greater than -0.1% and less than 0. In addition, the Slow Average should be above the Median Average in the Didi Index.
• For a "Buy Alert Projection", the Fast Average should be below the Median Average, and the percentage difference between the Fast Average and the Median Average should be greater than -0.1% and less than 0. In addition, the Slow Average should be above the Median Average in the Didi Index.
# Needle
After the Needle Alert, we have the Needle Confirmation, which occurs when the Slow Average crosses the Median Average after the alert. This signal is used to enter the operation. Let's divide this signal into two parts:
1. Needle: We use a filter of "3" (adjustable). This means that, to be considered a "Needle", the candle distance between the Alert (crossing of the Fast Average with the Median Average) and the Confirmation (crossing of the Slow Average with the Median Average) must be equal to or less than 3 candles. Also, there needs to be a trend on the ADX and the Bollinger Bands should be open.
2. Queijo Minas Needle (QM): Essentially, it's a Needle that occurs outside of the filter, with a candle distance between the Alert and the Confirmation above "3" candles. A trend on the ADX and open Bollinger Bands are also necessary.
To anticipate the Needle Confirmation, we use the "Needle Projection" signal. This signal has two filters: the "Needle Projection with Alert", set as "0.1%", and the "Needle Projection after the Alert", set as "0.3%".
1. The "Needle Projection with Alert" generates the signal when the "Needle Alert" occurs (crossing of the Fast Average with the Median Average), as long as the difference between the Slow Average and the Median Average is less than 0.1%.
2. The "Needle Projection after the Alert" generates the signal when the Fast Average has already crossed the Median Average, and the difference between the Slow Average and the Median Average should be less than 0.3%.
# BJMA (Spider Woman's Kiss)
There is another variation of the needle called BJMA. Essentially, it occurs when the Fast Average and the Slow Average approach the Median Average (each on one pole), but do not cross the Median and return to where they came from. In this signal, we have two filters: "Delta BJMA previous candle" and "Delta BJMA current candle". Let's see an example:
• Buy BJMA: First, we observe the previous candle, where the Fast Average must be above 0 (above the Median Average) and the percentage difference should be less than 0.02. In relation to the Slow Average, the configuration is the same, but in the negative sense, that is, it should be below 0 and above -0.02. Now, in the current candle, the Fast Average should be above 0 and below 0.05, while the Slow Average should be below 0 and above -0.05.
• Sell BJMA: First, we observe the previous candle, where the Fast Average must be below 0 (below the Median Average) and the percentage difference should be greater than -0.02. In relation to the Slow Average, the configuration is the same, but in the positive sense, that is, it should be above 0 and below 0.02. Now, in the current candle, the Fast Average should be below 0 and above -0.05, while the Slow Average should be above 0 and below 0.05.
Now, let's look at two signals that are commonly used to stay in a position.
# Fake Point
The Fake Point is primarily used to identify retracements before a continuation of the prevailing trend. Typically, it is preceded by a Needle Confirmation or BJMA signal. Here are some examples:
• Fake Sell (Signal to Maintain a Buy Position): The Fast Average crosses the Median from top to bottom (entering the negative pole of the Didi Index), while the Slow Average, which is already below the Median (below 0), continues to decline further, increasing the percentage difference between the Fast and Slow Averages in the negative pole.
• Fake Buy (Signal to Maintain a Sell Position): It is the same as the fake sell scenario but in the positive pole. The Fast Average crosses the Median, entering the positive pole of the Didi Index, while the Slow Average, which was already above the Median, continues to increase the percentage difference with the Median. For example, if the Slow Average was at +1 on the Didi Index, it would now be at +1.3.
There is also another variation of the Fake Breakout that takes into consideration the ADX (Average Directional Index) to confirm the trend direction. In other words, if we have a fake sell signal that suggests a buy position, we want the ADX to indicate a buying trend, and vice versa.
# Bought and Sold
This signal basically checks whether the indicators continue to confirm the previous signals. There are two variations: "Bought/Sold" and "Bought/Sold without Bollinger Bands". Let's see an example:
• Bought: The Didi Index is in the buying position, which means the Fast Average is above the Median Average (above 0), and the Slow Average is below the Median Average. Additionally, the ADX is indicating a buying trend and the Bollinger Bands are open.
• Sold: The Didi Index is in the selling position, which means the Fast Average is below 0 and the Slow Average is above 0. Moreover, the ADX is indicating a selling trend and the Bollinger Bands are open.
• Bought/Sold without Bollinger Bands: It's the same signal, but without considering whether the Bollinger Bands are open or not.
We can also consider the "Bought/Sold" signal based on the Trix and Stochastic, which would be additional confirmations of the movement.
Personally, I do not activate the Bought/Sold signal.
Now we come to signals to exit the position or take partial profits.
# Close
This exit signal is based on the following indicators: ADX, Bollinger Bands, Trix, and Stochastic. We wait for the ADX Kick or the falling ADX, along with the Bollinger Bands closing, and the Trix and Stochastic changing to the opposite side. Let's see some examples:
• Close a Buy: The ADX was in a buying trend (ADX rising and DI+ above DI-), but then the ADX Kick occurs or the ADX starts to fall. In addition, the Bollinger Bands close, and the Trix and Stochastic should switch to the sell signal.
• Close a Sell: The ADX was in a selling trend (ADX rising and DI- above DI+), but then the ADX Kick occurs or the ADX starts to fall. Also, the Bollinger Bands close, and the Trix and Stochastic should switch to the buy signal.
All indicators must provide signals together, but it is not necessary for all to occur in the exact same candle. For example:
1. The ADX Kick may occur, and the Trix and Stochastic switch to the buy signal, but the Bollinger Bands still remain open. In this case, we still do not have the exit signal.
2. In the next candle, the ADX continues to fall (after the Kick), the Trix and Stochastic continue to indicate buying, but this time the Bollinger Bands close. In this case, we have the "Close a Sell" signal.
It is important that all indicators are in accordance with the necessary signals, even if they occur in different candles, in order for the exit signal to be triggered.
# Close with Alert
This signal occurs when the Didi Index switches to the opposite side from where it was, along with a trend on the ADX, provided it's not a fake point. Let's see some examples:
• Close Buy - Sell Alert: Suppose we were in a buy position on the previous candle. In the current candle, the Fast Average crosses the Median Average from top to bottom, and the ADX indicates a sell trend. In this case, we completely close our buy position or make a partial realization.
• Close Sell - Buy Alert: Suppose we were in a sell position on the previous candle. In the current candle, the Fast Average crosses the Median Average from bottom to top, and the ADX indicates a buy trend. In this case, we completely close our sell position or make a partial realization.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Indicador baseado no Color Candles - Didi's Needles setup , mas agora focado exclusivamente na geração de alertas.
Com esse indicador, você pode configurar alertas e notificações no TradingView para até 15 ativos com base no setup de Didi Aguiar. Além disso, é possível definir se o alerta deve ser acionado no fechamento do candle ou X minutos antes do fechamento.
Também foi adicionado um filtro de sessão que permite configurar os alertas para serem acionados apenas durante uma sessão específica.
Descrição dos sinais monitorados:
O setup consiste no cruzamento de 3 médias móveis, juntamente com a análise da tendência no ADX e das bandas de Bollinger abertas.
As médias móveis serão nomeadas "Didi Index". Teremos a média de 3 períodos como "Média Rápida", a média de 8 períodos como "Média Mediana" e a média de 20 períodos como "Média Lenta". Quando a Média Rápida cruzar a Média Mediana, teremos um alerta e, quando a Média Lenta cruzar a Média Mediana, teremos uma confirmação. Para ajustar o Didi Index nos sinais, a Média Mediana foi normalizada, isto é, ela sempre será igual a 0. Para a Média Lenta e a Média Rápida, levaremos em consideração apenas a diferença percentual em relação à Média Mediana.
Além das médias móveis, analisamos se o ADX está em ascensão, com o DI+ acima do DI- para indicar uma tendência de alta, ou se o ADX está subindo, com o DI- acima do DI+ para indicar uma tendência de baixa. Também verificamos se as bandas de Bollinger estão abertas. Com essas condições, teremos uma Agulhada.
Agora vou detalhar como estabeleci isso no indicador e alguns filtros que inseri para o meu uso pessoal, além de alguns sinais adicionais do setup.
# Alerta de Agulhada
Primeiramente, temos o sinal de "Alerta de Agulhada". Este sinal acontece quando a Média Rápida cruza a Média Mediana, junto com a confirmação da tendência no ADX e a abertura das Bandas de Bollinger. O filtro está ajustado em "1", o que significa que só levaremos em consideração o alerta de agulhada quando a diferença percentual entre a Média Lenta e a Média Mediana estiver abaixo de 1%. Esse sinal pode ser utilizado como um ponto de entrada ou para monitorar o ativo. Vamos aos exemplos:
• Para um "Alerta de Compra", a Média Rápida deve cruzar a Média Mediana de baixo para cima, e a diferença percentual entre a Média Lenta e a Média Mediana deve ser menor que +1% e maior que 0, conforme indicado pelo Didi Index.
• Para um "Alerta de Venda", a Média Rápida deve cruzar a Média Mediana de cima para baixo, e a diferença percentual entre a Média Lenta e a Média Mediana deve ser maior que -1% e menor que 0, conforme indicado pelo Didi Index.
Também temos a projeção do alerta, que serve como um sinal para chamar atenção e monitorar o ativo. Eu uso um filtro de "0.1", o que significa que a diferença percentual entre a Média Rápida e a Média Mediana deve ser igual ou menor que 0.1%. Vamos ver o exemplo:
• Para uma "Projeção de Alerta de Compra", a Média Rápida deve estar abaixo da Média Mediana, e a diferença percentual entre a Média Rápida e a Média Mediana deve ser maior que -0.1% e menor que 0. Além disso, a Média Lenta deve estar acima da Média Mediana no Didi Index.
• Para uma "Projeção de Alerta de Compra", a Média Rápida deve estar abaixo da Média Mediana, e a diferença percentual entre a Média Rápida e a Média Mediana deve ser maior que -0.1% e menor que 0. Além disso, a Média Lenta deve estar acima da Média Mediana no Didi Index.
# Agulhada
Após o Alerta de Agulhada, temos a confirmação da Agulhada, que ocorre quando a Média Lenta cruza a Média Mediana após o alerta. Esse sinal é utilizado para entrar na operação. Vamos dividir esse sinal em duas partes:
1. Agulhada: Utilizamos um filtro de "3" (ajustável). Isso significa que, para ser considerada uma "Agulhada", a distância em velas entre o Alerta (cruzamento da Média Rápida com a Média Mediana) e a Confirmação (cruzamento da Média Lenta com a Média Mediana) deve ser igual ou menor que 3 velas. Além disso, é necessário ter uma tendência no ADX e as Bandas de Bollinger devem estar abertas.
2. Agulhada Queijo Minas (QM): Basicamente, é uma agulhada que ocorre fora do filtro, com uma distância em velas entre o Alerta e a Confirmação acima de "3" velas. Também é necessário ter uma tendência no ADX e as Bandas de Bollinger devem estar abertas.
Para antecipar a confirmação da Agulhada, utilizamos o sinal de "Projeção de Agulhada". Esse sinal possui dois filtros: o "Projeção de Agulhada com Alerta", configurado como "0.1%", e o "Projeção de Agulhada após o Alerta", configurado como "0.3%".
1. "Projeção de Agulhada com Alerta" gera o sinal quando ocorre o "Alerta de Agulhada" (cruzamento da Média Rápida com a Média Mediana), desde que a diferença entre a Média Lenta e a Média Mediana seja menor que 0.1%.
2. "Projeção de Agulhada após o Alerta" gera o sinal quando a Média Rápida já cruzou a Média Mediana, e a diferença entre a Média Lenta e a Média Mediana deve ser menor que 0.3%.
# BJMA (Beijo da Mulher Aranha)
Existe uma outra variação da agulhada chamada BJMA. Essencialmente, ocorre quando a Média Rápida e a Média Lenta se aproximam da Média Mediana (cada uma em um polo), mas não cruzam a Mediana e voltam para o lado de onde vieram. Nesse sinal, temos dois filtros: "Delta BJMA vela anterior" e "Delta BJMA vela atual". Vejamos um exemplo:
• BJMA de Compra: Primeiramente, observamos a vela anterior, onde a Média Rápida deve estar acima de 0 (acima da Média Mediana) e a diferença percentual deve ser menor que 0.02. Em relação à Média Lenta, a configuração é a mesma, porém no sentido negativo, ou seja, ela deve estar abaixo de 0 e acima de -0.02. Agora, na vela atual, a Média Rápida deve estar acima de 0 e abaixo de 0.05, enquanto a Média Lenta deve estar abaixo de 0 e acima de -0.05.
• BJMA de Venda: Primeiramente, observamos a vela anterior, onde a Média Rápida deve estar abaixo de 0 (abaixo da Média Mediana) e a diferença percentual deve ser maior que -0.02. Em relação à Média Lenta, a configuração é a mesma, porém no sentido positivo, ou seja, ela deve estar acima de 0 e abaixo de 0.02. Agora, na vela atual, a Média Rápida deve estar abaixo de 0 e acima de -0.05, enquanto a Média Lenta deve estar acima de 0 e abaixo de 0.05.
Agora vamos abordar dois sinais que são normalmente utilizados para manter uma posição.
# Ponto Falso (Fake Point)
O Ponto Falso é usado para identificar uma retração antes de retomar o movimento. Geralmente, ele ocorre após um sinal de Agulhada ou BJMA. Vejamos exemplos:
• Venda Falsa (sinal para manter uma posição de compra): A Média Rápida cruza a Média Mediana de cima para baixo (entrando no polo negativo do Didi Index), enquanto a Média Lenta, que já está abaixo da Média Mediana (abaixo de 0), continua caindo, aumentando assim a diferença percentual entre a Média Lenta e a Média Mediana no polo negativo.
• Compra Falsa (sinal para manter uma posição de venda): O cenário é semelhante, mas no polo positivo. A Média Rápida cruza a Média Mediana, passando para o lado positivo do Didi Index, enquanto a Média Lenta, que já estava acima da Média Mediana, continua aumentando a diferença percentual em relação à Média Mediana. Por exemplo, se a Média Lenta estava em +1 no Didi Index, agora ela está em +1.3.
Também existe uma variação do Ponto Falso em que verificamos se a tendência no ADX está se mantendo na mesma direção. Ou seja, se tivermos uma Venda Falsa (que seria um sinal para permanecermos em uma posição de compra), é importante que o ADX esteja indicando uma tendência de compra, e vice-versa. Dessa forma, consideramos não apenas o cruzamento das médias, mas também a confirmação da tendência no ADX. Essa variação é chamada de Ponto Falso com Tendência (Fake Point with Trend).
# Comprado e Vendido
Esse sinal, essencialmente, verifica se os indicadores estão mantendo a confirmação dos sinais anteriores. Existem duas variações: "Comprado/Vendido" e "Comprado/Vendido sem Bandas de Bollinger". Vejamos um exemplo:
• Comprado: O Didi Index está em compra, o que significa que a Média Rápida está acima da Média Mediana (acima de 0) e a Média Lenta está abaixo da Média Mediana. Além disso, o ADX está indicando uma tendência de compra e as Bandas de Bollinger estão abertas.
• Vendido: O Didi Index está em venda, o que significa que a Média Rápida está abaixo de 0 e a Média Lenta está acima de 0. Além disso, o ADX está indicando uma tendência de venda e as Bandas de Bollinger estão abertas.
• Comprado/Vendido sem Bollinger: É o mesmo sinal, porém sem considerar se as Bandas de Bollinger estão abertas ou não.
Podemos também considerar o "Comprado/Vendido" com base no Trix e no Estocástico, que seriam confirmações adicionais do movimento.
Eu, pessoalmente, não deixo ativado o sinal de Comprado/Vendido.
Agora chegamos aos sinais de saída da posição ou de realização parcial.
# Fechar (Close)
Este sinal de saída baseia-se nos seguintes indicadores: ADX, Bandas de Bollinger, Trix e Estocástico. Aguardamos o Kick do ADX ou o ADX em queda, juntamente com as Bandas de Bollinger se fechando, e o Trix e o Estocástico mudando para o lado oposto. Vamos ver alguns exemplos:
• Fechar uma Compra (Close Buy): O ADX estava em uma tendência de compra (ADX subindo e DI+ acima do DI-), mas em seguida ocorre o Kick do ADX ou o ADX começa a cair. Além disso, as Bandas de Bollinger se fecham e o Trix e o Estocástico devem mudar para o sinal de venda.
• Fechar uma Venda (Close Sell): O ADX estava em uma tendência de venda (ADX subindo e DI- acima do DI+), mas em seguida ocorre o Kick do ADX ou o ADX começa a cair. Além disso, as Bandas de Bollinger se fecham e o Trix e o Estocástico devem mudar para o sinal de compra.
Todos os indicadores devem fornecer os sinais em conjunto, mas não é necessário que todos ocorram exatamente na mesma vela. Por exemplo:
1. Pode ocorrer o Kick do ADX e o Trix e o Estocástico mudarem para o sinal de compra, mas as Bandas de Bollinger ainda permanecerem abertas. Nesse caso, ainda não teremos o sinal de saída.
2. No candle seguinte, o ADX continua caindo (após o Kick), o Trix e o Estocástico continuam indicando compra, mas desta vez as Bandas de Bollinger se fecham. Nesse caso, teremos o sinal de "Fechamento de uma Venda".
É importante que todos os indicadores estejam em conformidade com os sinais necessários, mesmo que ocorram em velas diferentes, para que seja acionado o sinal de saída.
# Fechar com Alerta (Close with Alert)
Esse sinal ocorre quando o Didi Index muda para o lado oposto do que estava, juntamente com uma tendência no ADX, desde que não seja um ponto falso. Vejamos exemplos:
• Fechar Compra - Alerta de Venda: Suponha que estávamos em uma posição de compra no candle anterior. No candle atual, a Média Rápida cruza a Média Mediana de cima para baixo, e o ADX indica uma tendência de venda. Nesse caso, encerramos completamente nossa posição de compra ou realizamos uma realização parcial.
• Fechar Venda – Alerta de Compra: Suponha que estávamos em uma posição de venda no candle anterior. No candle atual, a Média Rápida cruza a Média Mediana de baixo para cima, e o ADX indica uma tendência de compra. Nesse caso, encerramos completamente nossa posição de venda ou realizamos uma realização parcial.
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.
Support Resistance BreakthroughThe Support Resistance Breakthrough (SRB) is a comprehensive technical indicator that aims to evaluate market strength and detect potential breakout opportunities. It integrates the following elements:
ADX (Average Directional Index): Helps measure the overall trend strength. You can adjust both the ADX length and smoothing length.
ATR (Average True Range): Provides a measure of market volatility.
RSI (Relative Strength Index): Measures the momentum and helps identify overbought or oversold conditions.
Weighting Scheme: The weighting scheme adds or subtracts a fraction of the ROC of RSI, modulated by ATR and ADX. The weighting percentage can be customized.
Normalization Option: Allows the user to plot normalized values, scaling them between 0 and 100.
Horizontal Lines: Useful reference lines at 0, 50, and 100, displayed when normalization is used.
Interpretation: When the indicator is above the 0 line (or 50 when normalized), there's a high chance of breaking through resistance. Conversely, when it's below the 0 line, there's a high chance of breaking through support. Together with a momentum indicator, such as RSI and/or Stochastic RSI, this indicator functions excellently.
The combination of these elements makes the SRB an adaptable tool for various trading strategies. It can help identify potential breakout or breakdown areas and gauge the underlying strength of the market.
Compatibility with Adjustable Fibonacci Retracement Indicator: Together with the SRB indicator, the AFIBR can make it easier to determine the likelihood of breaking through support or resistance.
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.
Liquidity Levels/Voids (VP) [LuxAlgo]The Liquidity Levels/Voids (VP) is a script designed to detect liquidity voids & levels by measuring traded volume at all price levels on the market between two swing points and highlighting the distribution of the liquidity voids & levels at specific price levels.
🔶 USAGE
Liquidity is a fundamental market force that shapes the trajectory of assets.
The creation of a liquidity level comes as a result of an initial imbalance of supply/demand, which forms what we know as a swing high or swing low. As more players take positions in the market, these are levels that market participants will use as a historical reference to place their stops. When the levels are then re-tested, a decision will be made. The binary outcome here can be a breakout of the level or a reversal back to the mean.
Liquidity voids are sudden price changes that occur in the market when the price jumps from one level to another with little trading activity (low volume), creating an imbalance in price. The price tends to fill or retest the liquidity voids area, and traders understand at which price level institutional players have been active.
Liquidity voids are a valuable concept in trading, as they provide insights about where many orders were injected, creating this inefficiency in the market. The price tends to restore the balance.
🔶 SETTINGS
The script takes into account user-defined parameters and detects the liquidity voids based on them, where detailed usage for each user-defined input parameter in indicator settings is provided with the related input's tooltip.
🔹 Liquidity Levels / Voids
Liquidity Levels/Voids: Color customization option for Unfilled Liquidity Levels/Voids.
Detection Length: Lookback period used for the calculation of Swing Levels.
Threshold %: Threshold used for the calculation of the Liquidity Levels & Voids.
Sensitivity: Adjusts the number of levels between two swing points, as a result, the height of a level is determined, and then based on the above-given threshold the level is checked if it matches the liquidity level/void conditions.
Filled Liquidity Levels/Voids: Toggles the visibility of the Filled Liquidity Levels/Voids and color customization option for Filled Liquidity Levels/Voids.
🔹 Other Features
Swing Highs/Lows: Toggles the visibility of the Swing Levels, where tooltips present statistical information, such as price, price change, and cumulative volume between the two swing levels detected based on the detection length specified above, Coloring options to customize swing low and swing high label colors, and Size option to adjust the size of the labels.
🔹 Display Options
Mode: Controls the lookback length of detection and visualization.
# Bars: Lookback length customization, in case Mode is set to Present.
🔶 RELATED SCRIPTS
Liquidity-Voids-FVG
Buyside-Sellside-Liquidity
Swing-Volume-Profiles
Omega AnalystThe Omega Analyst is a toolkit designed to help both experienced and new traders with their trading decisions.
This indicator is a part of the omega toolkit, and his creation method is based on the concept that every trading strategy should have a way to determine the trend, or the bias, that answers the question “long or short?”; the location, which identifies the best price level to enter into a position and to exit, both in profit and in loss, and that will decide the final risk-to-reward ratio of the trade you take; the signal, which is useful to determine the best moment to enter into a position and that if paired with the trend point, his purpose is to identify when the large trend picture is in confluence with the small term; and last but not least the filter point, the filter is used to have another way to have an additional confluence with the trade you want to take, and it’s important to reduce the number of false signals and to increase the win rate.
This tool aims to help traders with the identification of the location points, thanks to different technical analysis tools that allow determining objectively if the price is in a discount area or in a premium area, to evaluate both entry and exit points. It’s important to note that indicator and technical analysis is only one of the several different ways to analyze an asset.
One of the main things to keep in mind when working with the financial markets is that not every asset, every historical phase, and every market condition is the same, this is why this tool can be highly personalized and adjustable and provide different overlay tools in order to allow traders to choose the best settings considering this variable and your backtests.
This tool, thanks to the previously cited characteristics, can work on any market and any horizontal time frame, and it has different features:
- 7 different tools of technical analysis to analyze the market, some of them with multiple variants.
- An additional tool to display the open price of different sessions
- Easy setup: You can easily choose which indicator to display in order to analyze the markets the best.
- Easy to use and easy to adjust: common settings for all the indicators are easily configurable in the settings with the length or the size parameter. Note that not all the indicators use both parameters, in particular: the indicator mode works for the consolidation levels, the range of motion, the sr zones, and the regression line; the continuous length parameter changes the settings to the consolidation levels, the range of motion, the sr zones, the Fibonacci area, and the regression line; the interval size parameter change the anchor to the volume price, the pivot points and the range of motion.
- Common aesthetics: You can easily change the default premium, discount, and average color in order to have the best view of the indicators together with the line width, or choose to have the monochrome setting to have a more minimalistic style.
- Common usage: Every one of these uses has the same functionality: determine if the price is the fair value, in a premium situation, or in the discount area.
- Automatic settings: The indicator can be used in “Auto” mode if it works with resets like the range of motion interval, the VWAP, the pivot points, and the open prices. This way the indicator will automatically adjust itself to show the optimal results for the analysis you want to make on your chosen timeframe.
The first tool is called Consolidation levels, and it’s a great tool to use during ranging markets.
The consolidation levels are support and resistance levels and zones automatically displayed on the chart to identify the range of bargaining, that adapts considering the price volatility and automatically moves once the price has broken the extreme levels.
This tool has two variants. The fixed variants have, just like the name says, all fixed levels that stay the same until the price doesn’t break one of them.
The Adaptive variants of the Consolidation levels tool have a unique feature that makes the support and resistance zones move considering the price volatility and standard deviation.
The second tool is called “Range of Motion” and it comes in two different versions, called “Continuous” and “Interval”. The difference is just that the “Interval” version stays the same for the whole duration of the interval length you choose.
The range of motion indicator allows the user to see the level that works like support and resistance and the area that works like premium and discount areas. The levels are calculated using the ATR indicator on the mean center line.
On the fixed variant of the range of motion indicator, these levels, once plotted, stay the same until the end of the chosen time frame in the interval size setting to plot the indicator. This way it’s easier to adopt a kind of analysis that uses passive orders like limit buy and limit sell orders. The interval range of motion indicator works like fixed extension levels that display the optimal range of bargaining of that specific asset.
The third tool is the Support and Resistance zones. With this tool, you'll see automatic support and resistance based on past prices and pivot data.
The area and the least efficient levels can be disabled using the "Interval" indicator mode.
The color area automatically changes looking at the effective support or resistance purpose of that area. The area also changes with the "Continuous length" parameter.
The fourth tool is the Fibonacci zones, which display the area of discount and premium pricing using the quartile theory, showing the 25% and the 75% of the current swings as area and the golden zone as a standard line, that includes the space between the 61.8% and the 38.2%, with the 50% line in the middle. This tool works like a Donchian Channel but it shows areas instead of simple lines. The usage of this indicator is both for trend following and for mean reversal, the general definition is that it shows attention zones.
Now in the photo, you can see the fifth tool which is the Anchored VWAP, under the name of "Volume Price". The Volume-weighted average price is a powerful indicator that aims to give the average price of a determined time period and can be used, combined with the standard deviation, to find not only support and resistance levels but also the volume-objective premium and discount zone.
This specific indicator displays 5 lines: the VWAP, the first upper and lower deviation, and the first and second upper deviation lines, that create the previously mentioned zone.
The sixth tool is the Pivot Points standard. This tool is a popular indicator that displays key levels for a determined period of time.
The levels for each interval time are five different lines. The middle one, colored by default in gray, should be the prediction, based on the key price levels of the previous period chosen, of the fair value. The other one, called S1 and R1 are respectively the first level of support and resistance and are great if used as exit points and when combined with other S/R tools, the same is valid for the S2 and R2 levels, on the extreme part of the indicator.
Between the R1 and the R2, and between the S1 and S2 lines there are the previously mentioned Discount and Premium zones.
The seventh tool is the Regression Line. This indicator will show the deviation bands from the standard regression line. Given the fact that the usual linear regression channels available are repainting, and so they don't give realistic outcomes, this tool will give you past results based on the data of the channel in that price moment, being non-repainting. This tool also has an extension that aims to be a prediction about future outcomes in terms of volatility and direction of the price, and this extension can be disabled using the "Continuous" mode.
Just like other tools in this indicator, the linear regression channel will display the middle line and the two premium and discount zones.
The last tool of the Omega Analyst is the open prices.
With this simple-to-read tool, you will see plotted as dotted lines the open prices of the period you have chosen.
The open prices are common support and resistance level and can be used both for entry and exit points. Additionally, on higher timeframes, such as the open prices of the different months, these levels can be further extended to the recent days to have more support and resistance levels.
This tool needs to be adjusted based on your time zone in order to have the best results and can be done directly in the settings of the indicator under the Open prices section, just simply write down at what time it’s midnight in your country watching the desired hour on the chart.
In order to determine the premium or discount area with this tool, you’ll need to pay attention if the current open price indicator is higher or lower than the previous one plotted, if it’s higher you can assume that the price is in an up trend and this way the zone under the current dotted line is the discount zone.
The lines you’ll see plotted are either in the chosen discount or premium color, based if the price is above or below the current open prices indicator plotted.
Risk Disclaimer:
All content and scripts provided are purely for informational & educational purposes only and do not constitute financial advice or a solicitation to buy or sell any securities of any type. Past performance does not guarantee future results. Trading can lead to a loss of the invested capital in the financial markets. 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.
Doji TrenderDoji Trender searches multiple timeframes for candles where open and close are less than dojiPercent apart (default 0.025%), and plots the trends between them.
Experiment with dojiPercent to change the number of "dojis" detected. I will add doji sub-type indication if it appears to be meaningful.
By default, it plots the 5m (red), 15m (orange), 1h (yellow), 4h (green), and chart (cyan). If the chart timeframe is any of the configurable ones, the chart copy won't be drawn. (I might reverse that, so that cyan is always drawn.)
Since doji points are somewhat sparse, and the lookback is short (default 10), the EMA's make drastic corrections toward new indecision. (I'm not convinced the EMA's are useful and/or relevant.)
This works on any timeframe, but seems to work best on the 1D. (5m is somewhat irrelevant on the 1D, so there are tweaks to be made.)
Dojis from a timeframe are corrections to a doji trend from a higher timeframe.
Red corrects to orange, corrects to yellow, corrects to green.
If the chart timeframe is > 4h, the others will correct to cyan.
Otherwise, cyan will fit in-between the adjacent timeframes.
Multiple indecision candles within a short timespan forming sharp peaks indicate retests, backtests, rejections, and bounces off of support/resistance.
With a correct larger-timeframe channel, one would expect lower-timeframe indecision at/along typical levels.
Although the doji's have unpredictable wicks, the dots printed by this indicator do not. Matched with volume, they reveal the prices where the most violent battles between bulls and bears took place, and are likely to take place, again.
One could:
1) Put trends on the longest segments, then look for confluence along them, and/or near the intersections.
2) Use lower-timeframe doji trends to estimate the direction of the higher-timeframe doji trends, before they become detectable to Doji Trender. Confirm by looking for confluence where those trends intersect with horizontal support/resistance, this indicator, and/or others.
3) Notice that multiple legs on the same trend line are close to parallel, if not colinear.
4) Notice that many of the doji segments point toward (very-distant) future dojis.
5) Drop horizontal lines on the dots where we previously reversed, and find confluence in VRVP when we revisit them.
6) Create parallel (fib/whatever) channels that more-closely match MM's intent. The segments one uses to set the angle of the channel, and those used to align the channel, vertically, are not always the same:
a) Match the channel slope to as many doji slopes as possible, considering every trend.
b) Figure out where the channel actually belongs, re-considering every trend.