Outside Bar ProbabilityOutside Bar Percentage by Hour Indicator
Description:
The "Outside Bar Percentage by Hour" indicator is a powerful tool designed to analyze the occurrence of outside bars within each hour of the trading day. This indicator not only tracks the frequency of these key market events but also provides a detailed breakdown of their distribution, allowing traders to identify potential patterns and key trading hours.
What It Does:
Outside Bar Detection: The indicator identifies "outside bars," which occur when the high of a bar is higher than the previous bar's high, and the low is lower than the previous bar's low. These bars often signal significant market moves and potential reversals.
Hourly Analysis: The script tracks the total number of bars and outside bars for each hour (0 to 23) of the trading day. This granular analysis helps traders pinpoint specific hours when outside bars are more likely to occur.
Percentage Calculation: It calculates the percentage chance of an outside bar occurring for each hour, based on the total bars observed. This percentage provides a clear view of the likelihood of encountering an outside bar within a given hour, which can be critical for timing entries and exits.
Visual Representation: The data is displayed in a table format directly on the chart, showing:
Hour: The specific hour of the day.
Total Bars: The total number of bars observed during each hour.
Outside Bar Count: The number of outside bars detected in that hour.
Percentage: The calculated percentage chance of an outside bar occurring in each hour.
How It Works:
The indicator uses a loop to analyze each bar in real-time, checking if it qualifies as an outside bar. It then records the occurrence in arrays that track data for each hour.
At the start of each new day, the counts are reset to ensure the data remains relevant and accurate.
The percentage chance of an outside bar occurring is computed using the formula: (Outside Bar Count / Total Bar Count) * 100.
The results are neatly organized in a table that updates dynamically, providing traders with real-time insights.
How to Use It:
Identify Key Trading Hours: Use the table to observe the distribution of outside bars across different hours. This can help you identify when significant market moves are more likely to occur.
Time Your Entries and Exits: Understanding the likelihood of outside bars can assist in timing your trades, particularly if you use strategies that rely on volatility or market reversals.
Market Analysis: The percentage data can provide insights into the market's behavior during specific times, helping you refine your trading strategy based on historical patterns.
Concepts Underlying the Calculations:
The script leverages the concept of "outside bars," which are often considered indicators of potential reversals or significant market movements. By analyzing these bars across different hours, the indicator provides a temporal dimension to market analysis, helping traders understand when these pivotal events are most likely to occur.
The detailed hourly breakdown and percentage calculations offer a nuanced view of market activity, making it a valuable tool for traders looking to enhance their timing and strategic decision-making.
This indicator is suitable for all types of traders, including those focused on day trading, swing trading, or even longer-term analysis. It provides a unique perspective on market activity that can complement other technical indicators and analyses.
Padrões gráficos
Candlestick Reversal SignalsTitle: Candlestick Reversal Signals
This Pine Script indicator is designed to identify and plot signals for two key candlestick reversal patterns: Bullish and Bearish Engulfing patterns, as well as Bullish and Bearish Harami patterns. These patterns are widely recognized for their ability to indicate potential trend reversals in the market, providing traders with valuable insights for making informed trading decisions.
Features:
• Bullish Engulfing Pattern:
• Conditions: This pattern is identified when the current candle’s close is higher than the previous candle’s open, and the current candle’s open is lower than the previous candle’s close. Additionally, the current candle’s close must be higher than the previous candle’s close, and the current candle’s open must be lower than the previous candle’s open.
• Signal: When a Bullish Engulfing pattern is detected, a green label is plotted below the relevant bar, indicating a potential upward reversal.
• Bearish Engulfing Pattern:
• Conditions: This pattern is identified when the current candle’s close is lower than the previous candle’s open, and the current candle’s open is higher than the previous candle’s close. Additionally, the current candle’s close must be lower than the previous candle’s close, and the current candle’s open must be higher than the previous candle’s open.
• Signal: When a Bearish Engulfing pattern is detected, a red label is plotted above the relevant bar, indicating a potential downward reversal.
• Bullish Harami Pattern:
• Conditions: This pattern is identified when the previous candle is a bearish candle (open higher than close), and the current candle is a bullish candle (close higher than open) that is contained within the body of the previous bearish candle.
• Signal: When a Bullish Harami pattern is detected, a green label is plotted below the relevant bar, indicating a potential upward reversal.
• Bearish Harami Pattern:
• Conditions: This pattern is identified when the previous candle is a bullish candle (open lower than close), and the current candle is a bearish candle (close lower than open) that is contained within the body of the previous bullish candle.
• Signal: When a Bearish Harami pattern is detected, a red label is plotted above the relevant bar, indicating a potential downward reversal.
Usage:
To use this script, simply add it to your TradingView chart. The script will automatically highlight the Bullish and Bearish Engulfing patterns, as well as Bullish and Bearish Harami patterns, by plotting green and red labels on the chart. These visual signals make it easy to spot potential reversal points, helping traders to identify and capitalize on trading opportunities.
Example:
• When you see a green “Bullish Engulfing” label below a candlestick, it suggests that the market might reverse upwards, signaling a potential buy opportunity.
• Conversely, a red “Bearish Engulfing” label above a candlestick suggests a potential downward reversal, signaling a potential sell opportunity.
• A green “Bullish Harami” label below a candlestick also indicates a potential upward reversal.
• A red “Bearish Harami” label above a candlestick indicates a potential downward reversal.
This indicator is a valuable addition to any trader’s technical analysis toolkit, providing clear and actionable signals based on well-established candlestick patterns. By incorporating these reversal patterns into your analysis, you can enhance your trading strategy and improve your decision-making process.
All Harmonic Patterns [theEccentricTrader]█ OVERVIEW
This indicator automatically draws and sends alerts for all of the harmonic patterns in my public library as they occur. The patterns included are as follows:
• Bearish 5-0
• Bullish 5-0
• Bearish ABCD
• Bullish ABCD
• Bearish Alternate Bat
• Bullish Alternate Bat
• Bearish Bat
• Bullish Bat
• Bearish Butterfly
• Bullish Butterfly
• Bearish Cassiopeia A
• Bullish Cassiopeia A
• Bearish Cassiopeia B
• Bullish Cassiopeia B
• Bearish Cassiopeia C
• Bullish Cassiopeia C
• Bearish Crab
• Bullish Crab
• Bearish Deep Crab
• Bullish Deep Crab
• Bearish Cypher
• Bullish Cypher
• Bearish Gartley
• Bullish Gartley
• Bearish Shark
• Bullish Shark
• Bearish Three-Drive
• Bullish Three-Drive
█ CONCEPTS
Green and Red Candles
• A green candle is one that closes with a close price equal to or above the price it opened.
• A red candle is one that closes with a close price that is lower than the price it opened.
Swing Highs and Swing Lows
• A swing high is a green candle or series of consecutive green candles followed by a single red candle to complete the swing and form the peak.
• A swing low is a red candle or series of consecutive red candles followed by a single green candle to complete the swing and form the trough.
Peak and Trough Prices
• The peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the preceding green candle, depending on which is higher.
• The trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the preceding red candle, depending on which is lower.
Historic Peaks and Troughs
The current, or most recent, peak and trough occurrences are referred to as occurrence zero. Previous peak and trough occurrences are referred to as historic and ordered numerically from right to left, with the most recent historic peak and trough occurrences being occurrence one.
Upper Trends
• A return line uptrend is formed when the current peak price is higher than the preceding peak price.
• A downtrend is formed when the current peak price is lower than the preceding peak price.
• A double-top is formed when the current peak price is equal to the preceding peak price.
Lower Trends
• An uptrend is formed when the current trough price is higher than the preceding trough price.
• A return line downtrend is formed when the current trough price is lower than the preceding trough price.
• A double-bottom is formed when the current trough price is equal to the preceding trough price.
Range
The range is simply the difference between the current peak and current trough prices, generally expressed in terms of points or pips.
Wave Cycles
A wave cycle is here defined as a complete two-part move between a swing high and a swing low, or a swing low and a swing high. The first swing high or swing low will set the course for the sequence of wave cycles that follow; for example a chart that begins with a swing low will form its first complete wave cycle upon the formation of the first complete swing high and vice versa.
Figure 1.
Retracement and Extension Ratios
Retracement and extension ratios are calculated by dividing the current range by the preceding range and multiplying the answer by 100. Retracement ratios are those that are equal to or below 100% of the preceding range and extension ratios are those that are above 100% of the preceding range.
Fibonacci Retracement and Extension Ratios
The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding numbers, starting with 0 and 1. For example 0 + 1 = 1, 1 + 1 = 2, 1 + 2 = 3, and so on. Ultimately, we could go on forever but the first few numbers in the sequence are as follows: 0 , 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.
The extension ratios are calculated by dividing each number in the sequence by the number preceding it. For example 0/1 = 0, 1/1 = 1, 2/1 = 2, 3/2 = 1.5, 5/3 = 1.6666..., 8/5 = 1.6, 13/8 = 1.625, 21/13 = 1.6153..., 34/21 = 1.6190..., 55/34 = 1.6176..., 89/55 = 1.6181..., 144/89 = 1.6179..., and so on. The retracement ratios are calculated by inverting this process and dividing each number in the sequence by the number proceeding it. For example 0/1 = 0, 1/1 = 1, 1/2 = 0.5, 2/3 = 0.666..., 3/5 = 0.6, 5/8 = 0.625, 8/13 = 0.6153..., 13/21 = 0.6190..., 21/34 = 0.6176..., 34/55 = 0.6181..., 55/89 = 0.6179..., 89/144 = 0.6180..., and so on.
Fibonacci ranges are typically drawn from left to right, with retracement levels representing ratios inside of the current range and extension levels representing ratios extended outside of the current range. If the current wave cycle ends on a swing low, the Fibonacci range is drawn from peak to trough. If the current wave cycle ends on a swing high the Fibonacci range is drawn from trough to peak.
Measurement Tolerances
Tolerance refers to the allowable variation or deviation from a specific value or dimension. It is the range within which a particular measurement is considered to be acceptable or accurate. I have applied this concept in my pattern detection logic and have set default tolerances where applicable, as perfect patterns are, needless to say, very rare.
Chart Patterns
Generally speaking price charts are nothing more than a series of swing highs and swing lows. When demand outweighs supply over a period of time prices swing higher and when supply outweighs demand over a period of time prices swing lower. These swing highs and swing lows can form patterns that offer insight into the prevailing supply and demand dynamics at play at the relevant moment in time.
‘Let us assume… that you the reader, are not a member of that mysterious inner circle known to the boardrooms as “the insiders”… But it is fairly certain that there are not nearly so many “insiders” as amateur trader supposes and… It is even more certain that insiders can be wrong… Any success they have, however, can be accomplished only by buying and selling… hey can do neither without altering the delicate poise of supply and demand that governs prices. Whatever they do is sooner or later reflected on the charts where you… can detect it. Or detect, at least, the way in which the supply-demand equation is being affected… So, you do not need to be an insider to ride with them frequently… prices move in trends. Some of those trends are straight, some are curved; some are brief and some are long and continued… produced in a series of action and reaction waves of great uniformity. Sooner or later, these trends change direction; they may reverse (as from up to down), or they may be interrupted by some sort of sideways movement and then, after a time, proceed again in their former direction… when a price trend is in the process of reversal… a characteristic area or pattern takes shape on the chart, which becomes recognisable as a reversal formation… Needless to say, the first and most important task of the technical chart analyst is to learn to know the important reversal formations and to judge what they may signify in terms of trading opportunities’ (Edwards & Magee, 1948).
This is as true today as it was when Edwards and Magee were writing in the first half of the last Century, study your patterns and make judgements for yourself about what their implications truly are on the markets and timeframes you are interested in trading.
Over the years, traders have come to discover a multitude of chart and candlestick patterns that are supposed to pertain information on future price movements. However, it is never so clear cut in practice and patterns that where once considered to be reversal patterns are now considered to be continuation patterns and vice versa. Bullish patterns can have bearish implications and bearish patterns can have bullish implications. As such, I would highly encourage you to do your own backtesting.
There is no denying that chart patterns exist, but their implications will vary from market to market and timeframe to timeframe. So it is down to you as an individual to study them and make decisions about how they may be used in a strategic sense.
Harmonic Patterns
The concept of harmonic patterns in trading was first introduced by H.M. Gartley in his book "Profits in the Stock Market", published in 1935. Gartley observed that markets have a tendency to move in repetitive patterns, and he identified several specific patterns that he believed could be used to predict future price movements. The bullish and bearish Gartley patterns are the oldest recognized harmonic patterns in trading and all the other harmonic patterns are modifications of the original Gartley patterns. Gartley patterns are fundamentally composed of 5 points, or 4 waves.
Since then, many other traders and analysts have built upon Gartley's work and developed their own variations of harmonic patterns. One such contributor is Larry Pesavento, who developed his own methods for measuring harmonic patterns using Fibonacci ratios. Pesavento has written several books on the subject of harmonic patterns and Fibonacci ratios in trading. Another notable contributor to harmonic patterns is Scott Carney, who developed his own approach to harmonic trading in the late 1990s and also popularised the use of Fibonacci ratios to measure harmonic patterns. Carney expanded on Gartley's work and also introduced several new harmonic patterns, such as the Shark pattern and the 5-0 pattern.
█ INPUTS
• Change pattern and label colours
• Show or hide patterns individually
• Adjust pattern tolerances
• Set or remove alerts for individual patterns
█ NOTES
You can test the patterns with your own strategies manually by applying the indicator to your chart while in bar replay mode and playing through the history. You could also automate this process with PineScript by using the conditions from my swing and pattern libraries as entry conditions in the strategy tester or your own custom made strategy screener.
█ LIMITATIONS
All green and red candle calculations are based on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. This may cause some unexpected behaviour on some markets and timeframes. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with.
█ SOURCES
Edwards, R., & Magee, J. (1948) Technical Analysis of Stock Trends (10th edn). Reprint, Boca Raton, Florida: Taylor and Francis Group, CRC Press: 2013.
All Chart Patterns [theEccentricTrader]█ OVERVIEW
This indicator automatically draws and sends alerts for all of the chart patterns in my public library as they occur. The patterns included are as follows:
• Ascending Broadening
• Broadening
• Descending Broadening
• Double Bottom
• Double Top
• Triple Bottom
• Triple Top
• Bearish Elliot Wave
• Bullish Elliot Wave
• Bearish Alternate Flag
• Bullish Alternate Flag
• Bearish Flag
• Bullish Flag
• Bearish Ascending Head and Shoulders
• Bullish Ascending Head and Shoulders
• Bearish Descending Head and Shoulders
• Bullish Descending Head and Shoulders
• Bearish Head and Shoulders
• Bullish Head and Shoulders
• Bearish Pennant
• Bullish Pennant
• Ascending Wedge
• Descending Wedge
• Wedge
█ CONCEPTS
Green and Red Candles
• A green candle is one that closes with a close price equal to or above the price it opened.
• A red candle is one that closes with a close price that is lower than the price it opened.
Swing Highs and Swing Lows
• A swing high is a green candle or series of consecutive green candles followed by a single red candle to complete the swing and form the peak.
• A swing low is a red candle or series of consecutive red candles followed by a single green candle to complete the swing and form the trough.
Peak and Trough Prices
• The peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the preceding green candle, depending on which is higher.
• The trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the preceding red candle, depending on which is lower.
Historic Peaks and Troughs
The current, or most recent, peak and trough occurrences are referred to as occurrence zero. Previous peak and trough occurrences are referred to as historic and ordered numerically from right to left, with the most recent historic peak and trough occurrences being occurrence one.
Upper Trends
• A return line uptrend is formed when the current peak price is higher than the preceding peak price.
• A downtrend is formed when the current peak price is lower than the preceding peak price.
• A double-top is formed when the current peak price is equal to the preceding peak price.
Lower Trends
• An uptrend is formed when the current trough price is higher than the preceding trough price.
• A return line downtrend is formed when the current trough price is lower than the preceding trough price.
• A double-bottom is formed when the current trough price is equal to the preceding trough price.
Range
The range is simply the difference between the current peak and current trough prices, generally expressed in terms of points or pips.
Retracement and Extension Ratios
Retracement and extension ratios are calculated by dividing the current range by the preceding range and multiplying the answer by 100. Retracement ratios are those that are equal to or below 100% of the preceding range and extension ratios are those that are above 100% of the preceding range.
Measurement Tolerances
Tolerance refers to the allowable variation or deviation from a specific value or dimension. It is the range within which a particular measurement is considered to be acceptable or accurate. I have applied this concept in my pattern detection logic and have set default tolerances where applicable, as perfect patterns are, needless to say, very rare.
Chart Patterns
Generally speaking price charts are nothing more than a series of swing highs and swing lows. When demand outweighs supply over a period of time prices swing higher and when supply outweighs demand over a period of time prices swing lower. These swing highs and swing lows can form patterns that offer insight into the prevailing supply and demand dynamics at play at the relevant moment in time.
‘Let us assume… that you the reader, are not a member of that mysterious inner circle known to the boardrooms as “the insiders”… But it is fairly certain that there are not nearly so many “insiders” as amateur trader supposes and… It is even more certain that insiders can be wrong… Any success they have, however, can be accomplished only by buying and selling… hey can do neither without altering the delicate poise of supply and demand that governs prices. Whatever they do is sooner or later reflected on the charts where you… can detect it. Or detect, at least, the way in which the supply-demand equation is being affected… So, you do not need to be an insider to ride with them frequently… prices move in trends. Some of those trends are straight, some are curved; some are brief and some are long and continued… produced in a series of action and reaction waves of great uniformity. Sooner or later, these trends change direction; they may reverse (as from up to down), or they may be interrupted by some sort of sideways movement and then, after a time, proceed again in their former direction… when a price trend is in the process of reversal… a characteristic area or pattern takes shape on the chart, which becomes recognisable as a reversal formation… Needless to say, the first and most important task of the technical chart analyst is to learn to know the important reversal formations and to judge what they may signify in terms of trading opportunities’ (Edwards & Magee, 1948).
This is as true today as it was when Edwards and Magee were writing in the first half of the last Century, study your patterns and make judgements for yourself about what their implications truly are on the markets and timeframes you are interested in trading.
Over the years, traders have come to discover a multitude of chart and candlestick patterns that are supposed to pertain information on future price movements. However, it is never so clear cut in practice and patterns that where once considered to be reversal patterns are now considered to be continuation patterns and vice versa. Bullish patterns can have bearish implications and bearish patterns can have bullish implications. As such, I would highly encourage you to do your own backtesting.
There is no denying that chart patterns exist, but their implications will vary from market to market and timeframe to timeframe. So it is down to you as an individual to study them and make decisions about how they may be used in a strategic sense.
█ INPUTS
• Change pattern and label colours
• Show or hide patterns individually
• Adjust pattern ratios and tolerances
• Set or remove alerts for individual patterns
█ NOTES
I have decided to rename some of my previously published patterns based on the way in which the pattern completes. If the pattern completes on a swing high then the pattern is considered bearish, if the pattern completes on a swing low then it is considered bullish. This may seem confusing but it makes sense when you come to backtesting the patterns and want to use the most recent peak or trough prices as stop losses. Patterns that can complete on both a swing high and swing low are for such reasons treated as neutral, namely all broadening and wedge variations. I trust that it is quite self-evident that double and triple bottom patterns are considered bullish while double and triple top patterns are considered bearish, so I did not feel the need to rename those.
The patterns that have been renamed and what they have been renamed to, are as follows:
• Ascending Elliot Waves to Bearish Elliot Waves
• Descending Elliot Waves to Bullish Elliot Waves
• Ascending Head and Shoulders to Bearish Ascending Head and Shoulders
• Descending Head and Shoulders to Bearish Descending Head and Shoulders
• Head and Shoulders to Bearish Head and Shoulders
• Ascending Inverse Head and Shoulders to Bullish Ascending Head and Shoulders
• Descending Inverse Head and Shoulders to Bullish Descending Head and Shoulders
• Inverse Head and Shoulders to Bullish Head and Shoulders
You can test the patterns with your own strategies manually by applying the indicator to your chart while in bar replay mode and playing through the history. You could also automate this process with PineScript by using the conditions from my swing and pattern libraries as entry conditions in the strategy tester or your own custom made strategy screener.
█ LIMITATIONS
All green and red candle calculations are based on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. This may cause some unexpected behaviour on some markets and timeframes. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with.
█ SOURCES
Edwards, R., & Magee, J. (1948) Technical Analysis of Stock Trends (10th edn). Reprint, Boca Raton, Florida: Taylor and Francis Group, CRC Press: 2013.
OrderBlock Trend (CISD)OrderBlock Trend (CISD) Indicator
Overview:
The "OrderBlock Trend (CISD)" AKA: change in state of delivery by ICT inner circle trader this indicator is designed to help traders identify and visualize market trends based on higher timeframe candle behavior. This script leverages the concept of order blocks, which are price levels where significant buying or selling activity has occurred, to signal potential trend reversals or continuations. By analyzing bullish and bearish order blocks on a higher timeframe, the indicator provides visual cues and statistical insights into the market's current trend dynamics.
Key Features:
Higher Timeframe Analysis: The indicator uses a higher timeframe (e.g., Daily) to assess the trend direction based on the open and close prices of candles. This approach helps in identifying more significant and reliable trend changes, filtering out noise from lower timeframes.
Bullish and Bearish Order Blocks: The script detects the first bullish or bearish candle on the selected higher timeframe and uses these candles as reference points (order blocks) to determine the trend direction. A bullish trend is indicated when the current price is above the last bearish order block's open price, and a bearish trend is indicated when the price is below the last bullish order block's open price.
Visual Trend Indication: The indicator visually represents the trend using background colors and plot shapes:
A green background and a square shape above the bars indicate a bullish trend.
A red background and a square shape above the bars indicate a bearish trend.
Candle Count and Statistics: The script keeps track of the number of up and down candles during bullish and bearish trends, providing percentages of up and down candles in each trend. This data is displayed in a table, giving traders a quick overview of market sentiment during each trend phase.
User Customization: The higher timeframe can be adjusted according to the trader's preference, allowing flexibility in trend analysis based on different time horizons.
Concepts and Calculations:
The "OrderBlock Trend (CISD)" indicator is based on the concept of order blocks, a key area where institutional traders are believed to place large orders, creating significant support or resistance levels. By identifying these blocks on a higher timeframe, the indicator aims to highlight potential trend reversals or continuations. The use of higher timeframe data helps filter out minor fluctuations and focus on more meaningful price movements.
The candle count and percentage calculations provide additional context, allowing traders to understand the proportion of bullish or bearish candles within each trend. This information can be useful for assessing the strength and consistency of a trend.
How to Use:
Select the Higher Timeframe: Choose the higher timeframe (e.g., Daily) that best suits your trading strategy. The default setting is "D" (Daily), but it can be adjusted to other timeframes as needed.
Interpret the Trend Signals:
A green background indicates a bullish trend, while a red background indicates a bearish trend. The corresponding square shapes above the bars reinforce these signals.
Use the information on the proportion of up and down candles during each trend to gauge the trend's strength and consistency.
Trading Decisions: The indicator can be used in conjunction with other technical analysis tools and indicators to make informed trading decisions. It is particularly useful for identifying trend reversals and potential entry or exit points based on the behavior of higher timeframe order blocks.
Customization and Optimization: Experiment with different higher timeframes and settings to optimize the indicator for your specific trading style and preferences.
Conclusion:
The "OrderBlock Trend (CISD)" indicator offers a comprehensive approach to trend analysis, combining the power of higher timeframe order blocks with clear visual cues and statistical insights. By understanding the underlying concepts and utilizing the provided features, traders can enhance their trend detection and decision-making processes in the markets.
Disclaimer:
This indicator is intended for educational purposes and should be used in conjunction with other analysis methods. Always perform your own research and risk management before making trading decisions.
Some known bugs when you switch to lower timeframe while using daily timeframe data it didn't use the daily candle close to establish the trend change but your current time frame If some of you know how to fix it that would be great if you help me to I would try my best to fix this in the future :) credit to ChatGPT 4o
Prospect Theory IndicatorProspect Theory Indicator
This indicator is designed based on Prospect Theory, which was developed by Nobel laureates Daniel Kahneman and Amos Tversky. Prospect Theory explains how people make decisions involving risk and uncertainty, highlighting their tendency to value potential losses more than equivalent gains and their focus on relative gains and losses rather than absolute outcomes.
Features:
1. Reference Points: The indicator calculates and displays the highest and lowest prices over a specified period (default is 14 periods). These are the reference points used to evaluate current price movements.
2. Risk/Reward Ratio: It calculates the risk/reward ratio by comparing the current price to the reference points. The risk is defined as the distance to the lowest point, and the reward as the distance to the highest point.
3. Visual Indicators:
• Green Line: Indicates the highest reference point (High Reference Point).
• Red Line: Indicates the lowest reference point (Low Reference Point).
• Green Triangle: Displays when the reward outweighs the risk, suggesting a favorable condition for entering a trade.
• Red Triangle: Displays when the risk outweighs the reward, suggesting a cautious approach.
4. Labels: Provides real-time labels showing the risk/reward ratio, and marks the current conditions as “High Risk” or “High Reward” based on the calculated ratio.
Usage:
• Entry Signals: Use green triangles for potential buy entries when the reward is higher than the risk.
• Exit Signals: Use red triangles as a signal to review your positions, as the risk has become higher than the reward.
• Risk Management: Continuously monitor the risk/reward ratio to maintain optimal risk management in your trading strategy.
This indicator helps traders make more informed and objective decisions, mitigating the emotional biases described by Prospect Theory.
[SGM Ordinal Patterns]An ordinal pattern is a concept used in mathematics and time series analysis. It is a way of describing the relative order of values in a sequence. Rather than focusing on the exact values, we are interested in how they compare to each other.
An ordinal pattern will tell you how these values are positioned relative to each other.
We do not look at the exact values, but only their order.
Concrete Example
• 4 (position 1 in the original sequence) is in position 2 in the ordered sequence.
• 7 (position 2 in the original sequence) is in position 3 in the ordered sequence.
• 2 (position 3 in the original sequence) is in position 1 in the ordered sequence.
The ordinal pattern for this sequence is then (2,3,1)(2, 3, 1)(2,3,1).
Script Explanation
This script analyzes ordinal patterns based on the closing prices of the last three bars and calculates the future gains associated with each ordinal pattern.
The main elements of the script are:
1. ordinal_pattern Function:
o Determines the ordinal pattern based on three past closing values.
o Returns an index (from 0 to 5) corresponding to one of the six possible ordinal patterns.
2. Calculations and Storage:
o For each new bar, the last three closes are used to identify the ordinal pattern.
o Future gains are calculated and associated with the previous ordinal pattern.
o Return statistics (mean, standard deviation and Sharpe ratio) are calculated for each pattern.
3. Visualization:
o Draws lines connecting the last three closes.
o Tables displaying the number of occurrences, distributions, and return statistics for each ordinal pattern.
What the Script Shows:
• Table motifs_table : Number of occurrences and distribution of each ordinal pattern. An uneven distribution between patterns (different by one sixth for each pattern) can indicate market inefficiency.
• Table pattern_analysis : Analysis of returns (mean, standard deviation, Sharpe ratio) for each ordinal pattern.
• Table current_motif_table : Ordinal pattern of the last bar.
This script helps to understand and visualize how ordinal patterns influence future returns of financial asset prices. An uneven distribution of patterns can indicate market inefficiencies.
Bullish Breakout After ConsolidationDescription:
The Bullish Breakout After Consolidation Indicator is designed to help traders identify potential bullish breakout opportunities following a period of tight price consolidation. This indicator combines price action and volume analysis to signal when a stock may experience a significant upward movement.
Features:
Consolidation Range Tightness: The indicator identifies periods where the stock price consolidates within a narrow range, defined as a range less than 2% of the lowest low during the consolidation period. This tight consolidation is often a precursor to strong price movements.
Breakout Detection: Once the price breaks above the highest high of the consolidation range, and this breakout occurs after a specified number of days post-consolidation, the indicator marks it as a potential breakout opportunity.
Volume Confirmation: To avoid false breakouts, the indicator requires increased trading volume during the breakout. This ensures that the breakout is supported by substantial market activity.
Visual Cues:
Breakout Label: A "Breakout" label appears above the bar where a valid breakout occurs, making it easy to spot potential entry points.
Support and Resistance Lines: Horizontal lines plot the highest high (resistance) and lowest low (support) during the consolidation period, helping traders visualize the breakout levels.
Moving Averages: Optional 20-day and 50-day simple moving averages are plotted for additional trend confirmation.
How to Use:
Apply the Indicator: Add the indicator to your chart in TradingView to start analyzing potential breakouts.
Observe Consolidation: Look for tight consolidation periods where the price trades within a narrow range.
Identify Breakouts: Watch for breakouts where the price moves above the highest high of the consolidation range, supported by increased volume.
Confirm with Labels: The "Breakout" label will help you quickly identify valid breakout signals.
Parameters:
Consolidation Length: Number of days to consider for consolidation.
Range Percentage: Maximum percentage range for consolidation tightness.
Days After Consolidation: Number of days post-consolidation to check for the breakout.
Note: As with any trading tool, it is important to use this indicator as part of a broader trading strategy and in conjunction with other forms of analysis.
Disclaimer: This indicator is provided for educational purposes and should not be construed as financial advice. Trading involves risk and may not be suitable for all investors.
Entropy Volatility Index [CHE]I Entropy Volatility Index (EVI)
II An Experimental Script for Measuring Market Volatility
III Introduction
The Entropy Volatility Index (EVI) is an experimental indicator based on concepts from thermodynamics and information theory. The goal of the EVI is to quantify market uncertainty and volatility by calculating the entropy of price changes.
IV Basic Concepts
Entropy in Thermodynamics
Entropy is a measure of disorder or randomness in a system.
The second law of thermodynamics states that entropy in a closed system tends to increase over time.
Entropy in Information Theory
In information theory, entropy measures the uncertainty or information content of a random variable.
The entropy H of a random variable X with probability distribution P(x) is calculated as:
H(X) = -∑ P(x) log P(x)
V Derivation of the EVI
Calculation of Price Changes
Absolute price changes are calculated to serve as the basis for probability calculations.
Creation of the Histogram
A histogram is created and initialized to count the frequency of price changes.
Updating the Histogram
The histogram is updated by counting the frequency of each price change.
Calculation of Probabilities
The probabilities of the price changes are calculated based on their frequencies in the histogram.
Calculation of Entropy
Entropy is calculated using the probabilities of price changes. Higher entropy indicates higher uncertainty or disorder in the market.
Plotting the Indicator
The EVI is plotted to visually represent market volatility and uncertainty.
VI Interpretation of the EVI
High EVI Values
High Volatility: Strong and irregular price movements.
High Uncertainty: Increased market uncertainty.
Possible Market Turning Points: Indicators of potential trend changes.
Low EVI Values
Low Volatility: More consistent and predictable price movements.
Stability: More stable market phases.
Trend Consistency: Indicators of stable trends or sideways movements.
VII Conclusion
The Entropy Volatility Index (EVI) is an experimental script that applies concepts from thermodynamics and information theory to measure market volatility. It offers a new perspective on market uncertainty and can be used as an additional tool for traders.
VIII Example Use Cases
Identifying Volatile Phases: Use the EVI to identify periods of high volatility and prepare for potential rapid price movements.
Risk Management: Adjust your risk management strategy based on the EVI. During high EVI periods, consider hedging positions or adjusting position sizes.
Complementing Other Indicators: Combine the EVI with other technical indicators (e.g., RSI, MACD) for a more comprehensive view of market conditions.
I hope this experimental script provides valuable insights. Thank you for your feedback and suggestions for improvement.
Best regards,
Chervolino
Moving Average Confluence [ST]Moving Average Confluence
Description in English:
This indicator uses multiple moving averages (SMA, EMA, WMA) with different periods to identify confluence points that can indicate support or resistance zones.
Detailed Explanation:
Configuration:
SMA Length: This input defines the period for the Simple Moving Average (SMA). The default value is 50.
EMA Length: This input defines the period for the Exponential Moving Average (EMA). The default value is 50.
WMA Length: This input defines the period for the Weighted Moving Average (WMA). The default value is 50.
Confluence Threshold: This input defines the maximum allowable difference between the moving averages to consider them in confluence. The default value is 0.01.
Calculation of Moving Averages:
SMA: Calculated as the simple arithmetic mean of the closing prices over the specified period.
EMA: Calculated by giving more weight to recent prices.
WMA: Calculated by weighting the closing prices based on their age.
Identification of Confluence:
Confluence is identified when the differences between SMA, EMA, and WMA are all within the specified threshold. This can indicate potential support or resistance zones.
Plotting:
The SMA, EMA, and WMA are plotted with different colors for easy identification.
Confluence points are marked with yellow labels on the chart.
Indicator Benefits:
Support and Resistance Identification: Helps traders identify potential support and resistance zones through the confluence of different moving averages.
Visual Cues: Provides clear visual signals for confluence points, aiding in making informed trading decisions.
Customizable Parameters: Allows traders to adjust the periods of the moving averages and the confluence threshold to suit different trading strategies and market conditions.
Justification of Component Combination:
Combining multiple types of moving averages (SMA, EMA, WMA) provides a comprehensive view of market trends. Identifying confluence points where these averages are close together can indicate strong support or resistance levels.
How Components Work Together:
The script calculates the SMA, EMA, and WMA for the specified periods.
It then checks if the differences between these moving averages are within the specified threshold.
When a confluence is detected, it is marked on the chart with a yellow label, providing a clear visual signal to the trader.
Título: Confluência de Médias Móveis
Descrição em Português:
Este indicador utiliza várias médias móveis (SMA, EMA, WMA) com diferentes períodos para identificar pontos de confluência que podem indicar zonas de suporte ou resistência.
Explicação Detalhada:
Configuração:
Comprimento da SMA: Este parâmetro define o período para a Média Móvel Simples (SMA). O valor padrão é 50.
Comprimento da EMA: Este parâmetro define o período para a Média Móvel Exponencial (EMA). O valor padrão é 50.
Comprimento da WMA: Este parâmetro define o período para a Média Móvel Ponderada (WMA). O valor padrão é 50.
Limite de Confluência: Este parâmetro define a diferença máxima permitida entre as médias móveis para considerá-las em confluência. O valor padrão é 0.01.
Cálculo das Médias Móveis:
SMA: Calculada como a média aritmética simples dos preços de fechamento ao longo do período especificado.
EMA: Calculada atribuindo mais peso aos preços mais recentes.
WMA: Calculada ponderando os preços de fechamento com base em sua idade.
Identificação de Confluência:
A confluência é identificada quando as diferenças entre SMA, EMA e WMA estão todas dentro do limite especificado. Isso pode indicar potenciais zonas de suporte ou resistência.
Plotagem:
A SMA, EMA e WMA são plotadas com cores diferentes para fácil identificação.
Pontos de confluência são marcados com etiquetas amarelas no gráfico.
Benefícios do Indicador:
Identificação de Suporte e Resistência: Ajuda os traders a identificar potenciais zonas de suporte e resistência através da confluência de diferentes médias móveis.
Sinais Visuais Claros: Fornece sinais visuais claros para pontos de confluência, auxiliando na tomada de decisões informadas.
Parâmetros Personalizáveis: Permite que os traders ajustem os períodos das médias móveis e o limite de confluência para se adequar a diferentes estratégias de negociação e condições de mercado.
Justificação da Combinação de Componentes:
Combinar vários tipos de médias móveis (SMA, EMA, WMA) fornece uma visão abrangente das tendências do mercado. Identificar pontos de confluência onde essas médias estão próximas pode indicar níveis fortes de suporte ou resistência.
Como os Componentes Funcionam Juntos:
O script calcula a SMA, EMA e WMA para os períodos especificados.
Em seguida, verifica se as diferenças entre essas médias móveis estão dentro do limite especificado.
Quando uma confluência é detectada, ela é marcada no gráfico com uma etiqueta amarela, fornecendo um sinal visual claro para o trader.
Prometheus Black-Scholes Option PricesThe Black-Scholes Model is an option pricing model developed my Fischer Black and Myron Scholes in 1973 at MIT. This is regarded as the most accurate pricing model and is still used today all over the world. This script is a simulated Black-Scholes model pricing model, I will get into why I say simulated.
What is an option?
An option is the right, but not the obligation, to buy or sell 100 shares of a certain stock, for calls or puts respective, at a certain price, on a certain date (assuming European style options, American options can be exercised early). The reason these agreements, these contracts exist is to provide traders with leverage. Buying 1 contract to represent 100 shares of the underlying, more often than not, at a cheaper price. That is why the price of the option, the premium , is a small number. If an option costs $1.00 we pay $100.00 for it because 100 shares * 1 dollar per share = 100 dollars for all the shares. When a trader purchases a call on stock XYZ with a strike of $105 while XYZ stock is trading at $100, if XYZ stock moves up to $110 dollars before expiration the option has $5 of intrinsic value. You have the right to buy something at $105 when it is trading at $110. That agreement is way more valuable now, as a result the options premium would increase. That is a quick overview about how options are traded, let's get into calculating them.
Inputs for the Black-Scholes model
To calculate the price of an option we need to know 5 things:
Current Price of the asset
Strike Price of the option
Time Till Expiration
Risk-Free Interest rate
Volatility
The price of a European call option 𝐶 is given by:
𝐶 = 𝑆0 * Φ(𝑑1) − 𝐾 * 𝑒^(−𝑟 * 𝑇) * Φ(𝑑2)
where:
𝑆0 is the current price of the underlying asset.
𝐾 is the strike price of the option.
𝑟 is the risk-free interest rate.
𝑇 is the time to expiration.
Φ is the cumulative distribution function of the standard normal distribution.
𝑑1 and 𝑑2 are calculated as:
𝑑1 = (ln(𝑆0 / 𝐾) + (𝑟 + (𝜎^2 / 2)) * 𝑇) / (𝜎 * sqrt(𝑇))
𝑑2= 𝑑1 - (𝜎 * sqrt(𝑇))
𝜎 is the volatility of the underlying asset.
The price of a European put option 𝑃 is given by:
𝑃 = 𝐾 * 𝑒^(−𝑟 * 𝑇) * Φ(−𝑑2) − 𝑆0 * Φ(−𝑑1)
where 𝑑1 and 𝑑2 are as defined above.
Key Assumptions of the Black-Scholes Model
The price of the underlying asset follows a lognormal distribution.
There are no transaction costs or taxes.
The risk-free interest rate and volatility of the underlying asset are constant.
The underlying asset does not pay dividends during the life of the option.
The markets are efficient, meaning that all known information is already reflected in the prices.
Options can only be exercised at expiration (European-style options).
Understanding the Script
Here I have arrows pointing to specific spots on the table. They point to Historical Volatility and Inputted DTE . Inputted DTE is a value the user may input to calculate premium for options that expire in that many days. Historical Volatility , is the value calculated by this code.
length = 252 // One year of trading days
hv = ta.stdev(math.log(close / close ), length) * math.sqrt(365)
And then made daily like the Black-Scholes model needs from this step in the code.
hv_daily = request.security(syminfo.tickerid, "1D", hv)
The user has the option to input their own volatility to the Script. I will get into why that may be advantageous in a moment. If the user chooses to do so the Script will change which value it is using as so.
hv_in_use = which_sig == false ? hv_daily : sig
There is a lot going on in this image but bare with me, it will all make sense by the end. The column to the far left of both the green and maroon colored columns represent the strike price of the contract, if the numbers are white that means the contract is out of the money, gray means in the money. If you remember from the calculation this represents the price to buy or sell shares at, for calls or puts respective. The column second from the left shows a value for Simulated Market Price . This is a necessary part of this script so we can show changes in implied volatility. See, when we go to our brokerages and look at options prices, sure the price was calculated by a pricing model, but that is rarely the true price of the model. Market participant sentiment affects this value as their estimates for future volatility, Implied Volatility changes.
For example, if a call option is supposed to be worth $1.00 from the pricing model, however everyone is bullish on the stock and wants to buy calls, the premium may go to $1.20 from $1.00 because participants juice up the Implied Volatility . Higher Implied Volatility generally means higher premium, given enough time to expiration. Buying an option at $0.80 when it should be worth $1.00 due to changes in sentiment is a big part of the Quant Trading industry.
Of course I don't have access to an actual exchange so get prices, so I modeled participant decisions by adding or subtracting a small random value on the "perfect premium" from the Black-Scholes model, and solving for implied volatility using the Newton-Raphson method.
It is like when we have speed = distance / time if we know speed and time , we can solve for distance .
This is what models the changing Implied Volatility in the table. The other column in the table, 3rd from the left, is the Black-Scholes model price without the changes of a random number. Finally, the 4th column from the left is that Implied Volatility value we calculated with the modified option price.
More on Implied Volatility
Implied Volatility represents the future expected volatility of an asset. As it is the value in the future it is not know like Historical Volatility, only projected. We provide the user with the option to enter their own Implied Volatility to start with for better modeling of options close to expiration. If you want to model options 1 day from expiration you will probably have to enter a higher Implied Volatility so that way the prices will be higher. Since the underlying is so close to expiration they are traded so much and traders manipulate their Implied Volatility , increasing their value. Be safe while trading these!
Thank you all for clicking on my indicator and reading this description! Happy coding, Happy trading, Be safe!
Good reference: www.investopedia.com
Gartley Harmonic Pattern [TradingFinder] Harmonic Chart patterns🔵 Introduction
Research by H.M. Gartley and Scott Carney emphasizes the importance of harmonic patterns in technical analysis for predicting market movements. Gartley's work, particularly the Gartley 222 pattern, is detailed in his book "Profits in the Stock Market" and relies on the specific placement of points X, A, B, C, and D.
🟣 Defining the Gartley Pattern
The Gartley pattern is a powerful technical analysis tool often seen at the end of a trend, signaling a potential reversal. Ideally, it forms during the first and second waves of Elliott Wave theory, with wave XA representing wave 1 and the entire ABCD correction representing wave 2.
While patterns outside this structure are also valid, the key points of the Gartley pattern align closely with Fibonacci retracement levels. Specifically, point B corrects wave XA to the 61.8% level, point C lies between 38% and 79% of wave AB, and point D extends between 113% and 162% of wave BC.
The bullish Gartley pattern, shown below, forms at the end of a downtrend and signals a potential buying opportunity.
Bullish :
Bearish :
🔵 How to Use
🟣 Bullish Gartley Pattern
To spot a bullish Gartley pattern, follow these rules: the move from point X to point A (the first leg) must be upward. The subsequent move from point A to point B is downward, followed by an upward move from point B to point C.
Finally, the move from point C to point D is downward. On a chart, this pattern resembles the letter M. After the final leg of this pattern, prices are expected to rise from point D.
🟣 Bearish Gartley Pattern
A bearish Gartley pattern forms similarly to the bullish one but in reverse. The initial move from point X to point A should be downward. The next move from point A to point B is upward, followed by a downward move from point B to point C.
The final leg moves upward from point C to point D. This pattern appears as a W on charts, indicating that prices are likely to fall from point D after the final move.
By understanding and identifying Gartley patterns, traders can enhance their technical analysis and improve their decision-making in financial markets. These patterns, when correctly identified, offer significant insights into potential market reversals and continuation patterns.
🔵 Setting
🟣 Logical Setting
ZigZag Pivot Period : You can adjust the period so that the harmonic patterns are adjusted according to the pivot period you want. This factor is the most important parameter in pattern recognition.
Show Valid Format : If this parameter is on "On" mode, only patterns will be displayed that they have exact format and no noise can be seen in them. If "Off" is, the patterns displayed that maybe are noisy and do not exactly correspond to the original pattern
Show Formation Last Pivot Confirm : if Turned on, you can see this ability of patterns when their last pivot is formed. If this feature is off, it will see the patterns as soon as they are formed. The advantage of this option being clear is less formation of fielded patterns, and it is accompanied by the latest pattern seeing and a sharp reduction in reward to risk.
Period of Formation Last Pivot : Using this parameter you can determine that the last pivot is based on Pivot period.
🟣 Genaral Setting
Show : Enter "On" to display the template and "Off" to not display the template.
Color : Enter the desired color to draw the pattern in this parameter.
LineWidth : You can enter the number 1 or numbers higher than one to adjust the thickness of the drawing lines. This number must be an integer and increases with increasing thickness.
LabelSize : You can adjust the size of the labels by using the "size.auto", "size.tiny", "size.smal", "size.normal", "size.large" or "size.huge" entries.
🟣 Alert Setting
Alert : On / Off
Message Frequency : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
Show Alert Time by Time Zone : The date, hour, and minute you receive in alert messages can be based on any time zone you choose. For example, if you want New York time, you should enter "UTC-4". This input is set to the time zone "UTC" by default.
SL ManagerSTOP LOSS MANAGER
Overview:
The "SL Manager" indicator is designed to assist traders in managing their stop loss (SL) and take profit (TP) levels for both long and short positions. This tool helps you visualize intermediate levels, enhancing your trading decisions by providing crucial information on the chart.
Usage:
This indicator is particularly useful for traders who want to manage their trades more effectively by visualizing potential adjustment points for their stop loss and take profit levels. It helps in making informed decisions to maximize profits and minimize risks by providing clear levels to take partial profits and adjust stop losses.
Features:
Position Input: Select between "long" and "short" positions.
Entry Price: Specify the entry price of your trade.
Take Profit: Define the price level at which you want to take profit.
Stop Loss: Set the stop loss price level to manage your risk.
Intermediate Levels:
For both long and short positions, the indicator calculates and plots the following intermediate levels:
50% Take Profit (TP 50%): Midway between the entry price and the take profit level, where you can take partial profits and move your SL up to the 25% mark.
75% Take Profit (TP 75%): Three-quarters of the way from the entry price to the take profit level, where you can take partial profits and move your SL to breakeven.
Stop Loss Move to 25% (SL Move to 25%): A level where the stop loss can be adjusted to lock in profits.
Visualization:
The indicator plots the calculated levels directly on the chart, provided the data for the current day is available. Different color codes and line styles distinguish between the various levels:
TP 50% and TP 75% are plotted in green.
SL Move to 25% is plotted in red .
Entry/Breakeven is plotted in blue.
MACD with SAR Indicator [CHE] MACD with SAR Indicator
Introduction
"The whole is greater than the sum of its parts. " The "MACD with SAR Indicator" is an innovative technical analysis tool that combines the strengths of the Moving Average Convergence Divergence (MACD) indicator with the Parabolic Stop and Reverse (SAR) indicator. This indicator provides traders with an enhanced method to detect trend changes and determine optimal entry and exit points in the market by using the SAR based on the MACD line to better identify reversal points. The combination generates clear trend reversal signals, which are visually represented through long (L) and short (S) signals on the chart.
Originality and Usefulness
This indicator differs from traditional MACD or SAR indicators by combining the trend-following calculations of the SAR with the trend strength and momentum calculations of the MACD. This enables a more precise identification of trend changes and provides clear buy and sell signals, which is particularly useful for manual traders.
Key Features and Functionality
1. Combination of MACD and SAR
- Why this Combination?: The MACD is known for its ability to measure the strength and direction of a trend, while the SAR is specifically designed to identify reversal points. By combining these two indicators, traders can better understand both the trend strength and potential turning points in the market.
- How Components Work Together: The MACD measures the difference between fast and slow moving averages, indicating market momentum. The SAR follows the MACD line instead of the price and marks potential reversal points more accurately. When the MACD signals a new trend and the SAR confirms it, the indicator provides reliable trading opportunities.
2. Adjustable Parameters
- MACD Settings: Users can adjust the lengths of the fast and slow moving averages (default: 28 and 38 periods) and the signal smoothing (default: 9 periods) to tailor the indicator to different market conditions.
- SAR Settings: Users can adjust the start value (default: 0.01), increment (default: 0.01), and maximum value (default: 0.18) of the SAR to control sensitivity and responsiveness.
3. Visual Representation and Signals
- Color-Coded Histograms: The histogram shows the difference between the MACD and signal line and is color-coded to highlight the direction of the trend.
- Signal Labels: The indicator automatically adds "L" (Long) and "S" (Short) labels on the chart to show the current positions to traders.
4. Alert Settings
- Custom Alerts: Alerts can be set to notify traders when the MACD and SAR experience significant state changes, such as when the histogram switches from rising to falling or vice versa.
5. Toggle Display
- Display Mode: Users can toggle the display of the MACD_SAR oscillator and MACD to focus on the information most relevant to their trading strategy.
Application and Benefits
- Versatility: This indicator can be used in various market conditions and for different trading strategies, including trend following and reversal trading.
- Ease of Interpretation: The clear visual representation and automatic signals make it easier for traders to identify trading opportunities and track trends.
- Customizability: With numerous settings options, the indicator can be tailored to individual preferences and specific market conditions.
Conclusion
The "MACD with SAR Indicator" is a valuable tool for traders seeking precise and reliable signals to identify market trends and make profitable trading decisions. With its extensive customization options, powerful features, and the ability to toggle displays, this indicator provides excellent support for technical analysis.
By emphasizing the synergy between the MACD and SAR indicators, highlighting the default settings, and clarifying that the SAR is based on the MACD line and generates clear trend reversal signals through long and short labels, this revised description should help users understand the functionalities and advantages of your indicator while meeting TradingView's publication requirements.
Best regards Chervolino
Gaussian Weighted Moving Average with Forecast [CHE]Presentation for TradingView: Gaussian Weighted Moving Average with Forecast
Introduction
Welcome to our presentation on the "Gaussian Weighted Moving Average with Forecast" (GWMA). This script, written in Pine Script™, offers an enhanced method for analyzing and predicting price movements on TradingView. The script combines Gaussian Weighted Moving Averages and polynomial regression to provide accurate and customizable forecasts.
Overview
Title: Gaussian Weighted Moving Average with Forecast
Author: chervolino
License: Mozilla Public License 2.0
Main Features
1. Gaussian Weighted Moving Average (GWMA):
- Calculates a weighted moving average using a Gaussian weighting function.
- Parameters for length and standard deviation allow fine-tuning of the smoothing effect.
2. Polynomial Regression with Forecast:
- Creates a model to predict future price movements.
- Adjustable length and degree of polynomial regression.
- Option to extrapolate predictions and visualize them.
3. Visual Representation:
- Uses lines and colors to depict trend changes.
- Customizable colors for upward and downward trends.
Input Parameters
Length: Length of the moving average (default: 50)
Standard Deviation: Standard deviation for Gaussian weighting (default: 10.0)
Width: Width of the plotted lines (default: 1)
Colors: Customizable colors for upward and downward trends
Forecast Length: Length of the forecast period (default: 20)
Extrapolate Length: Length of the extrapolation (default: 50)
Polynomial Degree: Degree of the polynomial regression (default: 3)
Lock Forecast: Option to lock and stabilize the forecast
Core Algorithms
1. Gaussian Weight Calculation:
gaussian_weight(x, std_dev) =>
1 / (std_dev * math.sqrt(2 * math.pi)) * math.exp(-0.5 * math.pow(x / std_dev, 2))
2. GWMA Calculation:
calculate_gwma(length, std_dev) =>
// Algorithm to calculate the weighted moving average
3. Initialize Lines for Polynomial Regression:
initialize_lines_array(extrapolate, length) =>
// Initialize array lines
4. Create Design Matrix for Polynomial Regression:
get_design_matrix(length, degree) =>
// Create the design matrix
5. Calculate and Plot Polynomial Regression:
calculate_polynomial_regression(src, length, degree, extrapolate, lines_arr, lock, width, upward_color, downward_color) =>
// Algorithm to calculate polynomial regression and plot the forecast
Combining Indicators: Originality and Usefulness
The combination of Gaussian Weighted Moving Average and polynomial regression provides traders with a robust tool for trend analysis and prediction. The GWMA smooths out price data while emphasizing recent prices, making it sensitive to short-term trends. Polynomial regression, on the other hand, offers a mathematical approach to model and forecast future prices based on historical data. By integrating these two methodologies, traders can achieve a more comprehensive view of market trends and potential future movements, making the tool highly valuable for decision-making.
Explanation for Users
Most TradingView users are not familiar with Pine Script, so a clear description is essential for understanding how to use the script.
Gaussian Weighted Moving Average (GWMA): This indicator calculates a moving average using Gaussian weights, which gives more importance to recent prices. The length and standard deviation parameters allow users to control the sensitivity and smoothness of the average.
Polynomial Regression with Forecast: This feature uses polynomial regression to model the price trend and predict future movements. Users can adjust the length of the historical data used, the degree of the polynomial, and the length of the forecast. The script plots these predictions, making it easier for traders to visualize potential future price paths.
Visualization of Results
1. GWMA Plotting:
plot(gaussian_ma_result, title="GWMA", color=line_color, linewidth=width_input)
2. Forecast Extrapolation:
plot(forecast_val, 'Extrapolation', offset=extrapolate_setting, linewidth=width_input, style=plot.style_circles)
Conclusion
The "Gaussian Weighted Moving Average with Forecast" script provides a powerful tool for analyzing and predicting price movements on TradingView. By combining Gaussian weighting and polynomial regression, it offers a precise and customizable method for trend analysis and forecasting.
Thank you for your attention! For any questions or further information, please feel free to reach out.
Algo Market Structure (Nephew_Sam_)This indicator takes a different approach into reading market structure.
The key difference between this logic compared to the pivot logic is; we read highs and lows based on bullish and bearish candles. Ie:
Pivot method - highest/lowest point in previous and next X candles
Algo method - Bullish candle(s) followed by a bearish candle and vice versa
More explanation in each of the key feature below.
Here are all of the concepts and features included in the indicator:
Timeframe
- You can select the timeframe of the indicator (has to be higher or equal to the chart timeframe)
- Min option is the minimum timeframe to show the indicator. If you show daily structure on 1m chart, you can run into a timeout error so keep it close to the chart timeframe.
- Recommended timeframe for no bugs is the current chart timeframe.
Structure
The structure is calculated using a combination of candle patterns (ie. pivot top = Bullish x3-Bearish-Bullish) and marks out circle labels after a new HH or LL
Structure high = 1 or more consecutive bull candles followed by a bear candle
Structure low = 1 or more consecutive bear candles followed by a bull candle
Structure direction change = when the second previous H/L is taken out (TLQ)
ILQ - Inducement Liquidity concept
In a bearish example this is the most recent structure high.
TLQ
In a bearish example this is the second most recent structure high.
This is also what helps define our structure direction. If broken, the structure changes (bullish / bearish) and plots a bos line.
EPA - Efficient price action
When price returns back to previous structure point after bos. Similar to an ICT breaker.
Note: It might be a little, just a little buggy if you have set your indicator timeframe to higher than the chart timeframe.
Extremes Zones
The final zone to find a trade entry before a structural shift. These are wick of the TLQ candle. This is select the wick of the current timeframe candle even if indicator is set to higher timeframe.
MSU
Tiny arrow labels at the bottom of your chart. Plots the arrows when price is between an ILQ and TLQ
VTA
Valid trading range. This is when we get some sort of a structure pattern. Plots a box when price induces previous structure point and then breaks structure in the opposite direction. Here are the patterns:
Bull VTA - HH-LL-HH
Bear VTA - LL-HH-LL
Bull Strict VTA - LL-HH-LL-HH
Bear Strict VTA - HH-LL-HH-LL
Bar colors
Changes the bar color based on the structure to all green/red.
Note: for this to work, you will have to right click on the indicator, then under visual order select 'bring to front'
Table
This table plots the structure stats/data
1. If structure is bullish / bearish
2. If price is efficient or not
3. If there is an MSU
4. If price is inside a VTA
Disclaimer: This indicator is fully written from scratch by me, the idea behind the concepts come from AlgoHub material on Youtube. Do NOT use this code for reselling purposes and if anything is created using any part of this code, the source code should be public.
Money Flow Index Crossover IndicatorThe "Money Flow Index Crossover Indicator" is a specialized technical analysis tool designed to assist traders by providing a clear visualization of potential buy and sell signals based on the Money Flow Index (MFI) and its smoothed moving average (SMA). This indicator delineates overbought and oversold zones, offering valuable insights into market dynamics. It operates as an oscillator on a separate pane, helping traders identify bullish and bearish market conditions with greater precision. By incorporating k-Nearest Neighbor (KNN) machine learning techniques, this indicator enhances the reliability and accuracy of the signals provided.
Originality and Usefulness:
This script is not just a simple mashup of existing indicators but integrates multiple components to create a unique and comprehensive analysis tool. The combined information from the MFI, its smoothed moving average, and the KNN machine learning techniques influence the form and accuracy of the Money Flow Index Average line and the Smoothed Money Flow Index line giving a visually helpful representation of overbought and oversold conditions. These lines are displayed in an oscillator style crossover, allowing users to visualize potential buy and sell zones for setting up potential signals. The user can adjust various settings of these tools behind the code to fine-tune the behavior and sensitivity of these lines. This integration provides a more robust and insightful trading tool that can adapt to different market conditions and trading styles.
How It Works:
Inputs:
MFI Settings:
Show Signals: Allows users to toggle the display of MFI and SMA crossing signals, which are critical for identifying potential market reversals.
Plot Amount: Determines the number of plots in the heat map, ranging from 2 to 28, enabling customization based on user preference.
Source: Defines the data source for MFI calculations, typically set to OHLC4 for a balanced view of price movements.
Smooth Initial MFI Length: Specifies the smoothing length for the initial MFI calculations to reduce noise and enhance signal clarity.
MFI SMA Length: Sets the length for the SMA used to smooth the MFI average, providing a more stable reference line.
Machine Learning Settings:
Use KInSource: Option to average MFI data by adding a lookback to the source, improving the accuracy of historical comparisons.
KNN Distance Requirement: Defines the distance calculation method for KNN (Max, Min, Both) to refine the data filtering process.
Machine Learning Length: Specifies the amount of machine learning data stored for smoothing results, balancing between responsiveness and stability.
KNN Length: Sets the number of KNN used to calculate the allowable distance range, enhancing the precision of the machine learning model.
Fast and Slow Lengths: Defines the lengths for fast and slow MFI calculations, allowing the indicator to capture different market dynamics.
Smoothing Length: Determines the length at which MFI calculations start for a more smoothed result, reducing false signals.
Variables and Functions:
KNN Function: Filters machine learning data to calculate valid distances based on defined criteria, ensuring more accurate MFI averages.
MFI Calculations: Computes both fast and slow MFI values, applies smoothing, and stores them for KNN processing to refine signal generation.
MFI KNN Calculation: Uses the KNN function to calculate the machine learning average of MFI values, enhancing signal reliability.
MFI Average and SMA: Calculates the average and smoothed MFI values, which are crucial for determining crossover signals.
Calculations:
MFI Values: Calculates current fast and slow MFI values and applies smoothing to reduce market noise.
Storage Arrays: Stores MFI data in arrays for KNN processing, enabling historical comparison and pattern recognition.
KNN Processing: Computes the machine learning average of MFI values using the KNN function, improving the robustness of signals.
MFI Average: Scales the MFI average to fit the heat map and calculates the smoothed SMA, providing a clear visual representation of trends.
Crossover Signals: Identifies bullish (MFI crossing above SMA) and bearish (MFI crossing below SMA) signals, which are key for making trading decisions.
Plots and Visuals:
MFI Average and SMA Lines: Plots the MFI average and smoothed SMA on the chart, allowing traders to easily visualize market trends and potential reversals.
Zones: Defines and plots overbought, neutral, and oversold zones for easy visualization. The recommended settings for these zones are:
Overbought Zone: Level set to approximately 24.6, indicating a potential market top.
Neutral Zone: Level set to 14, representing a balanced market condition.
Oversold Zone: Level set to 5.4, signaling a potential market bottom.
Crossover Marks: Plots circles on the chart to indicate bullish and bearish crossover signals, making it easier to spot entry and exit points.
Visual Alerts:
Bullish and Bearish Alerts: one can see overbought and oversold conditions and up alert conditions for bullish and bearish MFI crossover signals, enabling traders to have access to visual cues when these events are on trajectory to occur and, if they occur, act promptly with the visual representation of its zones.
Why It's Helpful:
The "Money Flow Index Crossover Indicator" provides traders with a sophisticated tool to identify potential buy and sell conditions based on the combined information of the MFI and its smoothed moving average. The KNN machine learning techniques enhance the accuracy of this indicator's clear visual representation of overbought, neutral, and oversold zones. This combination of data represented on the chart helps traders make informed decisions about market conditions. This indicator is particularly useful for traders looking to refine their entry and exit points by leveraging advanced data analysis in respect to overbought and oversold conditions.
Disclaimer:
This indicator is intended to assist traders in making informed decisions based on technical analysis. However, it is not a guarantee of future performance and should be used in conjunction with other analysis techniques and risk management practices. Past performance is not indicative of future results, and traders should exercise caution and perform their own due diligence before making any trading decisions.
Crab Harmonic Pattern [TradingFinder] Harmonic Chart patterns🔵 Introduction
The Crab pattern is recognized as a reversal pattern in technical analysis, utilizing Fibonacci numbers and percentages for chart analysis. This pattern can predict suitable price reversal areas on charts using Fibonacci ratios.
The structure of the Crab pattern can manifest in both bullish and bearish forms on the chart. By analyzing this structure, traders can identify points where the price direction changes, which are essential for making informed trading decisions.
The pattern's structure is visually represented on charts as shown below. To gain a deeper understanding of the Crab pattern's functionality, it is beneficial to become familiar with its various harmonic forms.
🟣 Types of Crab Patterns
The Crab pattern is categorized into two types based on its structure: bullish and bearish. The bullish Crab is denoted by the letter M, while the bearish Crab is indicated by the letter W in technical analysis.
Typically, a bullish Crab pattern signals a potential price increase, whereas a bearish Crab pattern suggests a potential price decrease on the chart.
The direction of price movement depends significantly on the price's position within the chart. By identifying whether the pattern is bullish or bearish, traders can determine the likely direction of the price reversal.
Bullish Crab :
Bearish Crab :
🔵 How to Use
When trading using the Crab pattern, crucial parameters include the end time of the correction and the point at which the chart reaches its peak. Generally, the best time to buy is when the chart nears the end of its correction, and the best time to sell is when it approaches the peak price.
As we discussed, the end of the price correction and the time to reach the peak are measured using Fibonacci ratios. By analyzing these levels, traders can estimate the end of the correction in the chart waves and select a buying position for their stock or asset upon reaching that ratio.
🟣 Bullish Crab Pattern
In this pattern, the stock price is expected to rise at the pattern's completion, transitioning into an upward trend. The bullish Crab pattern usually begins with an upward trend, followed by a price correction, after which the stock resumes its upward movement.
If a deeper correction occurs, the price will change direction at some point on the chart and rise again towards its target price. Price corrections play a critical role in this pattern, as it aims to identify entry and exit points using Fibonacci ratios, allowing traders to make purchases at the end of the corrections.
When the price movement lines are connected on the chart, the bullish Crab pattern resembles the letter M.
🟣 Bearish Crab Pattern
In this pattern, the stock price is expected to decline at the pattern's completion, leading to a strong downward trend. The bearish Crab pattern typically starts with a price correction in a downward trend and, after several fluctuations, reaches a peak where the direction changes downward, resulting in a significant price drop.
This pattern uses Fibonacci ratios to identify points where the price movement is likely to change direction, enabling traders to exit their positions at the chart's peak. When the price movement lines are connected on the chart, the bearish Crab pattern resembles the letter W.
🔵 Setting
🟣 Logical Setting
ZigZag Pivot Period : You can adjust the period so that the harmonic patterns are adjusted according to the pivot period you want. This factor is the most important parameter in pattern recognition.
Show Valid Format : If this parameter is on "On" mode, only patterns will be displayed that they have exact format and no noise can be seen in them. If "Off" is, the patterns displayed that maybe are noisy and do not exactly correspond to the original pattern.
Show Formation Last Pivot Confirm : if Turned on, you can see this ability of patterns when their last pivot is formed. If this feature is off, it will see the patterns as soon as they are formed. The advantage of this option being clear is less formation of fielded patterns, and it is accompanied by the latest pattern seeing and a sharp reduction in reward to risk.
Period of Formation Last Pivot : Using this parameter you can determine that the last pivot is based on Pivot period.
🟣 Genaral Setting
Show : Enter "On" to display the template and "Off" to not display the template.
Color : Enter the desired color to draw the pattern in this parameter.
LineWidth : You can enter the number 1 or numbers higher than one to adjust the thickness of the drawing lines. This number must be an integer and increases with increasing thickness.
LabelSize : You can adjust the size of the labels by using the "size.auto", "size.tiny", "size.smal", "size.normal", "size.large" or "size.huge" entries.
🟣 Alert Setting
Alert : On / Off
Message Frequency : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
Show Alert Time by Time Zone : The date, hour, and minute you receive in alert messages can be based on any time zone you choose. For example, if you want New York time, you should enter "UTC-4". This input is set to the time zone "UTC" by default.
R-Squared Trend Strength and Direction [CHE] Introduction
TradingView is a web-based platform that allows traders and investors to conduct comprehensive technical analyses, develop trading strategies, and track market movements in real-time. One of the many features TradingView offers is the ability to create custom indicators using Pine Script. In this presentation, we will focus on the implementation and application of an R-Squared indicator for analyzing trend strength and direction, as well as using the T3 indicator for trend direction confirmation.
---
What is R-Squared?
R-Squared (R²), also known as the coefficient of determination, is a statistical measure that represents the proportion of the variance for a dependent variable that's explained by an independent variable(s). In technical analysis, R-Squared is used to quantify the clarity of a trend. A higher R-Squared indicates a clearer trend, less affected by random price fluctuations.
---
Pine Script: Implementing the R-Squared Indicator
Inputs:
- Source: The data source to be analyzed, such as the average of high and low prices.
- Period: The period length for calculating sums and R-Squared values.
Sum Calculations:
- Sum X and Sum XX: These sums relate to the indices of the selected period.
- Sum XY and Sum YY: These sums relate to the products of the indices and their respective price values.
- Sum Y: The sum of price values over the chosen period.
Q-Values Calculation:
- Q-values are used to calculate the R-Squared value, which indicates trend clarity.
Trend State:
- Based on the R-Squared value, a trend state is determined, indicating whether a clear trend is present. Specific threshold values are used to identify trend changes.
---
Using the T3 Indicator
The T3 indicator is used exclusively for confirming the trend direction in this strategy. It helps verify the direction of the trend identified by the R-Squared indicator.
T3 Indicator Calculation:
- The T3 indicator uses a series of exponential smoothings to smooth price movements and provide a clearer view of the trend direction.
- The T3 indicator confirms the trend direction indicated by the R-Squared indicator.
---
Functioning of the R-Squared and T3 Combination
1. Input Parameters:
- Define the data source and period length for calculating sums and R-Squared values.
2. Sum Calculations:
- Calculate various sums over the defined period needed to derive Q-values.
3. Q-Values Calculation:
- Derive Q1, Q2, and Q3 from the sums to calculate the R-Squared value.
4. Trend State:
- Use the R-Squared value to determine if a clear trend is present, utilizing threshold values to recognize trend changes.
5. Trend Direction Confirmation with T3:
- Calculate the T3 indicator to confirm the trend direction. The T3 is used solely for direction confirmation, not for clarity.
6. Long and Short Conditions:
- Define long and short entry conditions based on the combination of R-Squared and T3 indicators, and visualize them on the chart.
---
Conclusion
The R-Squared indicator is a powerful tool for analyzing the clarity of a trend. By integrating it into TradingView using Pine Script, traders can make informed decisions and optimize their trading strategies. The T3 indicator is used exclusively in this strategy to confirm the trend direction, enhancing the accuracy of trading signals.
---
Questions and Discussion
Are there any questions about the implementation or application of the R-Squared indicator in TradingView? How can we further improve this indicator or integrate it into existing strategies?
Best regards
Chervolino
Advanced Fully Reversed Candles with Reversed IchimokuThe "Advanced Fully Reversed Candles with Reversed Ichimoku" indicator is a sophisticated tool designed for traders who seek a unique perspective on market dynamics. This innovative indicator not only reverses the traditional candlestick chart but also inverts the Ichimoku Cloud components, providing a comprehensive view of the market's inverted behavior.
Key Features:
Reversed Candlestick Chart:
The indicator recalculates the OHLC (Open, High, Low, Close) prices by reversing them along the price axis. This means that what typically would be an upward movement is displayed as a downward movement, and vice versa. This reversal provides an alternative view that can help traders identify hidden patterns and potential reversal points that might not be obvious on a standard chart.
Reversed Ichimoku Cloud:
All components of the Ichimoku Cloud indicator are recalculated based on the reversed price data. This includes:
Tenkan-sen (Conversion Line): Reversed based on the highest and lowest prices over the specified period.
Kijun-sen (Base Line): Reversed in a similar manner to the Tenkan-sen, providing a medium-term perspective on price trends.
Senkou Span A (Leading Span A): Reversed to form one boundary of the Kumo (cloud), offering insight into future support and resistance levels.
Senkou Span B (Leading Span B): Reversed to form the other boundary of the Kumo, complementing Senkou Span A.
Chikou Span (Lagging Span): Reversed and plotted backward for additional confirmation of trend direction and strength.
Dynamic Price Range Calculation:
The indicator dynamically calculates the maximum and minimum prices over the last 500 bars (or the available range if fewer bars are present). This ensures that the reversal is always based on the most relevant data, providing accurate and up-to-date visualizations.
Visual Enhancements:
The reversed candlesticks are color-coded for easy interpretation: green for upward movements and red for downward movements, based on the reversed data.
The Ichimoku Cloud is filled with semi-transparent colors to clearly distinguish between bullish and bearish conditions even in its reversed state.
Debugging Aids:
For transparency and accuracy, the indicator plots the maximum and minimum price lines used for the reversal calculations. This allows users to verify the internal workings of the indicator and ensure the reversal logic is correctly applied.
Usage:
This indicator is ideal for advanced traders and analysts who want to explore market behavior from an unconventional angle. By reversing both the candlestick chart and the Ichimoku Cloud, it provides a unique perspective that can uncover new trading opportunities and enhance market analysis.
Customization:
Users can customize the periods for the Tenkan-sen, Kijun-sen, and Senkou Span B, as well as the displacement for the Ichimoku Cloud. This flexibility allows traders to adapt the indicator to their specific trading strategies and timeframes.
Conclusion:
The "Advanced Fully Reversed Candles with Reversed Ichimoku" indicator is a powerful tool that transforms traditional market analysis. By inverting both price movements and key technical indicators, it opens up a new dimension of trading insights, helping traders to see the market in a completely different light.
Parameters:
Tenkan-sen period (default: 9)
Kijun-sen period (default: 26)
Senkou Span B period (default: 52)
Displacement (default: 26)
How to Apply:
Add the script to your TradingView account via the Pine Editor.
Customize the parameters according to your trading strategy.
Analyze the reversed candlestick chart and Ichimoku Cloud to gain unique insights into market trends and potential reversal points.
Edufx's Power of ThreeIndicator Overview
Name: Edufx's Power of Three
Purpose:
To highlight the high and low price ranges of specific hourly candles on a chart.
To visualize these ranges using rectangles.
Features
Visibility Toggle:
Users can enable or disable the visibility of the rectangles highlighting the high and low price ranges of the specified candles.
Customizable Rectangle Length:
Users can adjust the length of the rectangles that extend from the specified candle's high and low prices.
Price Range Tracking:
The high and low prices of the specified candles are tracked and stored.
Rectangle Drawing:
Rectangles are drawn from 5 bars before the end of the specified hour, highlighting the high and low price ranges.
How It Works
Price Range Tracking:
During each specified hour, the high and low prices are updated with the highest and lowest prices observed.
Rectangle Drawing:
At the end of each specified hour, the high and low prices are used to draw rectangles extending 5 bars backward from the end of the hour.
Rectangles are color-coded (red, green, and blue) for easy identification.
Usage
This indicator is useful for traders who want to monitor and react to key price levels at specific times of the day.
The visual rectangles help in identifying potential trading opportunities based on price action relative to these key levels.
Example
If the price moves above the high of the specified candle but fails to close above it, a visual rectangle will highlight this price range.
Similarly, if the price moves below the low of the specified candle but fails to close below it, the rectangle will indicate this range.
This indicator provides visual aids to assist traders in making informed decisions based on the behavior of price at specific key levels.
MNQ/NQ Rotations [Tiestobob]### Indicator Description: MNQ/NQ Rotations
TO BE USED ONLY ON THE CONTINOUS CONTRACTS NQ1! and MNQ1! It will not work on others or the forward contracts of these.
#### Overview
The MNQ/NQ Rotations indicator is designed for traders of Nasdaq futures (MNQ and NQ) to visualize key price levels where typical market rotations occur. This indicator identifies and highlights the xxx.20 and xxx.80 levels based on empirical data and trading experience, allowing traders to recognize potential support and resistance points during trading sessions.
#### Key Features
- **Timeframe Selection**: The indicator allows users to specify a timeframe for identifying breakout candles, ensuring flexibility across different trading strategies.
- **Active Trading Range**: Users can define an active trading range, focusing the analysis on specific hours when the market is most active.
- **Visual Representation**: The indicator paints horizontal lines at key price levels (xxx.20 and xxx.80), extending them across a user-defined length to aid in visual analysis.
- **Customization**: Users can customize the color of the lines to match their charting preferences.
#### Inputs
- **Timeframe (`tf`)**: Defines the timeframe to select the breakout candle (default: 1 minute).
- **Active Trading Range (`session`)**: Specifies the time range for identifying breakout candles (default: 08:00-12:00).
- **Line Color (`line_color`)**: Allows customization of the line color (default: purple).
#### Logic
1. **Session Validation**: The indicator checks if the current bar falls within the specified active trading range.
2. **Price Point Calculation**: For each candle close, the indicator calculates the nearest xxx.20 and xxx.80 levels.
3. **Line Drawing**: Horizontal lines are drawn at these key levels, extending a specified length forward to highlight potential rotation points.
#### Use Cases
- **Support and Resistance Identification**: By highlighting the xxx.20 and xxx.80 levels, traders can easily spot areas where the market is likely to reverse or consolidate.
- **Breakout Trading**: Traders can use the indicator to identify breakout levels and set appropriate entry points.
- **Risk Management**: The visual cues provided by the indicator can help traders set more effective stop-loss and take-profit levels.
#### Example
A trader using a 1-minute timeframe with an active trading range from 08:00 to 12:00 will see horizontal lines painted at the nearest xxx.20 and xxx.80 levels for each candle close during this period. These lines serve as visual markers for typical rotation points, aiding in decision-making and trade planning.
#### Conclusion
The MNQ/NQ Rotations indicator is a powerful tool for traders looking to enhance their market analysis of Nasdaq futures. By focusing on empirically derived rotation levels, this indicator provides clear visual cues for identifying key price levels, supporting more informed trading decisions.
HTF TriangleHTF Triangle by ZeroHeroTrading aims at detecting ascending and descending triangles using higher time frame data, without repainting nor misalignment issues.
It addresses user requests for combining Ascending Triangle and Descending Triangle into one indicator.
Ascending triangles are defined by an horizontal upper trend line and a rising lower trend line. It is a chart pattern used in technical analysis to predict the continuation of an uptrend.
Descending triangles are defined by a falling upper trend line and an horizontal lower trend line. It is a chart pattern used in technical analysis to predict the continuation of a downtrend.
This indicator can be useful if you, like me, believe that higher time frames can offer a broader perspective and provide clearer signals, smoothing out market noise and showing longer-term trends.
You can change the indicator settings as you see fit to tighten or loosen the detection, and achieve the best results for your use case.
Features
It draws the detected ascending and descending triangles on the chart.
It supports alerting when a detection occurs.
It allows for selecting ascending and/or descending triangle detection.
It allows for setting the higher time frame to run the detection on.
It allows for setting the minimum number of consecutive valid higher time frame bars to fit the pattern criteria.
It allows for setting a high/low factor detection criteria to apply on higher time frame bars high/low as a proportion of the distance between the reference bar high/low and open/close.
It allows for turning on an adjustment of the triangle using highest/lowest values within valid higher time frame bars.
Settings
Ascending checkbox: Turns on/off ascending triangle detection. Default is on.
Descending checkbox: Turns on/off descending triangle detection. Default is on.
Higher Time Frame dropdown: Selects higher time frame to run the detection on. It must be higher than, and a multiple of, the chart's timeframe. Default is 5 minutes.
Valid Bars Minimum field: Sets minimum number of consecutive valid higher time frame bars to fit the pattern criteria. Default is 3. Minimum is 1.
High/Low Factor checkbox: Turns on/off high/low factor detection criteria. Default is on.
High/Low Factor field: Sets high/low factor to apply on higher time frame bars high/low as a proportion of the distance between the reference bar high/low and open/close. Default is 0. Minimum is 0. Maximum is 1.
Adjust Triangle checkbox: Turns on/off triangle adjustment using highest/lowest values within valid higher time frame bars. Default is on.
Detection Algorithm Notes
The detection algorithm recursively selects a higher time frame bar as reference. Then it looks at the consecutive higher time frame bars (as per the requested number of minimum valid bars) as follows:
Ascending Triangle
Low must be higher than previous bar.
Open/close max value must be lower than (or equal to) reference bar high.
When high/low factor criteria is turned on, high must be higher than (or equal to) reference bar open/close max value plus high/low factor proportion of the distance between reference bar high and open/close max value.
Descending Triangle
High must be lower than previous bar.
Open/close min value must be higher than (or equal to) reference bar low.
When high/low factor criteria is turned on, low must be lower than (or equal to) reference bar open/close min value minus high/low factor proportion of the distance between reference bar low and open/close min value.