Dickey-Fuller Test for Mean Reversion and Stationarity **IF YOU NEED EXTRA SPECIAL HELP UNDERSTANDING THIS INDICATOR, GO TO THE BOTTOM OF THE DESCRIPTION FOR AN EVEN SIMPLER DESCRIPTION**
Dickey Fuller Test:
The Dickey-Fuller test is a statistical test used to determine whether a time series is stationary or has a unit root (a characteristic of a time series that makes it non-stationary), indicating that it is non-stationary. Stationarity means that the statistical properties of a time series, such as mean and variance, are constant over time. The test checks to see if the time series is mean-reverting or not. Many traders falsely assume that raw stock prices are mean-reverting when they are not, as evidenced by many different types of statistical models that show how stock prices are almost always positively autocorrelated or statistical tests like this one, which show that stock prices are not stationary.
Note: This indicator uses past results, and the results will always be changing as new data comes in. Just because it's stationary during a rare occurrence doesn't mean it will always be stationary. Especially in price, where this would be a rare occurrence on this test. (The Test Statistic is below the critical value.)
The indicator also shows the option to either choose Raw Price, Simple Returns, or Log Returns for the test.
Raw Prices:
Stock prices are usually non-stationary because they follow some type of random walk, exhibiting positive autocorrelation and trends in the long term.
The Dickey-Fuller test on raw prices will indicate non-stationary most of the time since prices are expected to have a unit root. (If the test statistic is higher than the critical value, it suggests the presence of a unit root, confirming non-stationarity.)
Simple Returns and Log Returns:
Simple and log returns are more stationary than prices, if not completely stationary, because they measure relative changes rather than absolute levels.
This test on simple and log returns may indicate stationary behavior, especially over longer periods. (The test statistic being below the critical value suggests the absence of a unit root, indicating stationarity.)
Null Hypothesis (H0): The time series has a unit root (it is non-stationary).
Alternative Hypothesis (H1): The time series does not have a unit root (it is stationary)
Interpretation: If the test statistic is less than the critical value, we reject the null hypothesis and conclude that the time series is stationary.
Types of Dickey-Fuller Tests:
1. (What this indicator uses) Standard Dickey-Fuller Test:
Tests the null hypothesis that a unit root is present in a simple autoregressive model.
This test is used for simple cases where we just want to check if the series has a consistent statistical property over time without considering any trends or additional complexities.
It examines the relationship between the current value of the series and its previous value to see if the series tends to drift over time or revert to the mean.
2. Augmented Dickey-Fuller (ADF) Test:
Tests for a unit root while accounting for more complex structures like trends and higher-order correlations in the data.
This test is more robust and is used when the time series has trends or other patterns that need to be considered.
It extends the regular test by including additional terms to account for the complexities, and this test may be more reliable than the regular Dickey-Fuller Test.
For things like stock prices, the ADF would be more appropriate because stock prices are almost always trending and positively autocorrelated, while the Dickey-Fuller Test is more appropriate for more simple time series.
Critical Values
This indicator uses the following critical values that are essential for interpreting the Dickey-Fuller test results. The critical values depend on the chosen significance levels:
1% Significance Level: Critical value of -3.43.
5% Significance Level: Critical value of -2.86.
10% Significance Level: Critical value of -2.57.
These critical values are thresholds that help determine whether to reject the null hypothesis of a unit root (non-stationarity). If the test statistic is less than (or more negative than) the critical value, it indicates that the time series is stationary. Conversely, if the test statistic is greater than the critical value, the series is considered non-stationary.
This indicator uses a dotted blue line by default to show the critical value. If the test-static, which is the gray column, goes below the critical value, then the test-static will become yellow, and the test will indicate that the time series is stationary or mean reverting for the current period of time.
What does this mean?
This is the weekly chart of BTCUSD with the Dickey-Fuller Test, with a length of 100 and a critical value of 1%.
So basically, in the long term, mean-reversion strategies that involve raw prices are not a good idea. You don't really need a statistical test either for this; just from seeing the chart itself, you can see that prices in the long term are trending and no mean reversion is present.
For the people who can't understand that the gray column being above the blue dotted line means price doesn't mean revert, here is a more simple description (you know you are):
Average (I have to include the meaning because they may not know what average is): The middle number is when you add up all the numbers and then divide by how many numbers there are. EX: If you have the numbers 2, 4, and 6, you add them up to get 12, and then divide by 3 (because there are 3 numbers), so the average is 4. It tells you what a typical number is in a group of numbers.
This indicator checks if a time series (like stock prices) tends to return to its average value or time.
Raw prices, which is just the regular price chart, are usually not mean-reverting (It's "always" positively autocorrelating but this group of people doesn't like that word). Price follows trends.
Simple returns and log returns are more likely to have periods of mean reversion.
How to use it:
Gray Column (the gray bars) Above the Blue Dotted Line: The price does not mean revert (non-stationary).
Gray Column Below Blue Line: The time series mean reverts (stationary)
So, if the test statistic (gray column) is below the critical value, which is the blue dotted line, then the series is stationary and mean reverting, but if it is above the blue dotted line, then the time series is not stationary or mean reverting, and strategies involving mean reversion will most likely result in a loss given enough occurrences.
Moving_average
Chuck Dukas Market Phases of Trends (based on 2 Moving Averages)This script is based on the article “Defining The Bull And The Bear” by Chuck Duckas, published in Stocks & Commodities V. 25:13 (14-22); (S&C Bonus Issue, 2007).
The article “Defining The Bull And The Bear” discusses the concepts of “bullish” and “bearish” in relation to the price behavior of financial instruments. Chuck Dukas explains the importance of analyzing price trends and provides a framework for categorizing price activity into six phases. These phases, including recovery, accumulation, bullish, warning, distribution, and bearish, help to assess the quality of the price structure and guide decision-making in trading. Moving averages are used as tools for determining the context preceding the current price action, and the slope of a moving average is seen as an indicator of trend and price phase analysis.
The six phases of trends
// Definitions of Market Phases
recovery_phase = src > ma050 and src < ma200 and ma050 < ma200 // color: blue
accumulation_phase = src > ma050 and src > ma200 and ma050 < ma200 // color: purple
bullish_phase = src > ma050 and src > ma200 and ma050 > ma200 // color: green
warning_phase = src < ma050 and src > ma200 and ma050 > ma200 // color: yellow
distribution_phase = src < ma050 and src < ma200 and ma050 > ma200 // color: orange
bearish_phase = src < ma050 and src < ma200 and ma050 < ma200 // color red
Recovery Phase : This phase marks the beginning of a new trend after a period of consolidation or downtrend. It is characterized by the gradual increase in prices as the market starts to recover from previous losses.
Accumulation Phase : In this phase, the market continues to build a base as prices stabilize before making a significant move. It is a period of consolidation where buying and selling are balanced.
Bullish Phase : The bullish phase indicates a strong upward trend in prices with higher highs and higher lows. It is a period of optimism and positive sentiment in the market.
Warning Phase : This phase occurs when the bullish trend starts to show signs of weakness or exhaustion. It serves as a cautionary signal to traders and investors that a potential reversal or correction may be imminent.
Distribution Phase : The distribution phase is characterized by the market topping out as selling pressure increases. It is a period where supply exceeds demand, leading to a potential shift in trend direction.
Bearish Phase : The bearish phase signifies a strong downward trend in prices with lower lows and lower highs. It is a period of pessimism and negative sentiment in the market.
These rules of the six phases outline the cyclical nature of market trends and provide traders with a framework for understanding and analyzing price behavior to make informed trading decisions based on the current market phase.
60-period channel
The 60-period channel should be applied differently in each phase of the market cycle.
Recovery Phase : In this phase, the 60-period channel can help identify the beginning of a potential uptrend as price stabilizes or improves. Traders can look for new highs frequently in the 60-period channel to confirm the trend initiation or continuation.
Accumulation Phase : During the accumulation phase, the 60-period channel can highlight that the current price is sufficiently strong to be above recent price and longer-term price. Traders may observe new highs frequently in the 60-period channel as the slope of the 50-period moving average (SMA) trends upwards while the 200-period moving average (SMA) slope is losing its downward slope.
Bullish Phase : In the bullish phase, the 60-period channel showing a series of higher highs is crucial for confirming the uptrend. Additionally, traders should observe an upward-sloping 50-period SMA above an upward-sloping 200-period SMA for further validation of the bullish phase.
Warning Phase : When in the warning phase, the 60-period channel can provide insights into whether the current price is weaker than recent prices. Traders should pay attention to the relationship between the price close, the 50-period SMA, and the 200-period SMA to gauge the strength of the phase.
Distribution Phase : In the distribution phase, traders should look for new lows frequently in the 60-period channel, hinting at a weakening trend. It is crucial to observe that the 50-period SMA is still above the 200-period SMA in this phase.
Bearish Phase : Lastly, in the bearish phase, the 60-period channel reflecting a series of lower lows confirms the downtrend. Traders should also note that the price close is below both the 50-period SMA and the 200-period SMA, with the relationship of the 50-period SMA being less than the 200-period SMA.
By carefully analyzing the 60-period channel in each phase, traders can better understand market trends and make informed decisions regarding their investments.
Volume-Enhanced Momentum Moving Average (VEMMA)Volume-Enhanced Momentum Moving Average (VEMMA)
Overview:
The Volume-Enhanced Momentum Moving Average (VEMMA) helps you spot market trends by combining momentum and volume as a moving average. This unique moving average adjusts itself based on the strength and activity of the market, giving you a clearer picture of what’s happening.
How It Works:
1. Key Settings (all of these are adjustable in the settings panel of the indicator):
◦ Base Length: Looks back over the last 50 days by default.
◦ Momentum Length: Uses the past 14 days to measure market strength.
◦ Volume Length: Uses the past 30 days to average trading volume.
◦ High/Low Thresholds: Considers RSI values above 70 as high momentum and below 30 as low momentum.
2. Momentum and Volume:
◦ Momentum: Calculated using the Relative Strength Index (RSI) to see if the market is gaining or losing strength.
◦ Volume: Average trading volume is calculated over the last 30 days to gauge trading activity.
3. VEMMA Calculation:
◦ For each of the past 50 days:
▪ Check Momentum: If RSI > 70, it’s high momentum; if RSI < 30, it’s low.
▪ Weight by Volume: High momentum days with high volume get more weight; low momentum days get less.
▪ Combine: Multiply the closing price by this weight and sum it up.
◦ Average: Divide the total by 50 to get the VEMMA value.
4. Visuals:
◦ Lines: Two lines, VEMMA1 (blue) and VEMMA2 (orange), show the adjusted moving averages.
◦ Colours: Background colors help you quickly spot high (green) and low (red) momentum periods.
How to Use:
• Spot Trends: Rising VEMMA lines suggest an uptrend; falling lines suggest a downtrend.
• Confirm Signals: When both VEMMA1 and VEMMA2 move together, it indicates a strong trend.
• Identify Reversals: Watch for background color changes from green to red or vice versa to catch potential trend reversals.
If the market has been strong and active, the VEMMA line will rise more sharply. If the market is weak and quiet, the line will be smoother.
Benefits:
• Integrated View: Combines market strength and trading activity for a fuller picture.
• Responsive: Adapts to significant market changes, highlighting key movements.
• Easy to Read: Clear visuals with color-coded backgrounds make interpretation simple.
Remember, just like any other indicator, this is not supposed to be used alone. Use it as part of your greater trading strategy. I do however believe it works exceptionally well for finding longer term trends early. The default VEMMA settings work very well as replacement for the EMA 200. Try it and see how it goes. Play around with the settings. Feedback appreciated.
Wall Street Cheat Sheet IndicatorThe Wall Street Cheat Sheet Indicator is a unique tool designed to help traders identify the psychological stages of the market cycle based on the well-known Wall Street Cheat Sheet. This indicator integrates moving averages and RSI to dynamically label market stages, providing clear visual cues on the chart.
Key Features:
Dynamic Stage Identification: The indicator automatically detects and labels market stages such as Disbelief, Hope, Optimism, Belief, Thrill, Euphoria, Complacency, Anxiety, Denial, Panic, Capitulation, Anger, and Depression. These stages are derived from the emotional phases of market participants, helping traders anticipate market movements.
Technical Indicators: The script uses two key technical indicators:
200-day Simple Moving Average (SMA): Helps identify long-term market trends.
50-day Simple Moving Average (SMA): Aids in recognizing medium-term trends.
Relative Strength Index (RSI): Assesses the momentum and potential reversal points based on overbought and oversold conditions.
Clear Visual Labels: The current market stage is displayed directly on the chart, making it easy to spot trends and potential turning points.
Usefulness:
This indicator is not just a simple mashup of existing tools. It uniquely combines the concept of market psychology with practical technical analysis tools (moving averages and RSI). By labeling the psychological stages of the market cycle, it provides traders with a deeper understanding of market sentiment and potential future movements.
How It Works:
Disbelief: Detected when the price is below the 200-day SMA and RSI is in the oversold territory, indicating a potential bottom.
Hope: Triggered when the price crosses above the 50-day SMA, with RSI starting to rise but still below 50, suggesting an early uptrend.
Optimism: Occurs when the price is above the 50-day SMA and RSI is between 50 and 70, indicating a strengthening trend.
Belief: When the price is well above the 50-day SMA and RSI is between 70 and 80, showing strong bullish momentum.
Thrill and Euphoria: Identified when RSI exceeds 80, indicating overbought conditions and potential for a peak.
Complacency to Depression: These stages are identified based on price corrections and drops relative to moving averages and declining RSI values.
Best Practices:
High-Time Frame Focus: This indicator works best on high-time frame charts, specifically the 1-week Bitcoin (BTCUSDT) chart. The longer time frame provides a clearer picture of the overall market cycle and reduces noise.
Trend Confirmation: Use in conjunction with other technical analysis tools such as trendlines, Fibonacci retracement levels, and support/resistance zones for more robust trading strategies.
How to Use:
Add the Indicator: Apply the Wall Street Cheat Sheet Indicator to your TradingView chart.
Analyze Market Stages: Observe the dynamic labels indicating the current stage of the market cycle.
Make Informed Decisions: Use the insights from the indicator to time your entries and exits, aligning your trades with the market sentiment.
This indicator is a valuable tool for traders looking to understand market psychology and make informed trading decisions based on the stages of the market cycle.
Total Cross CalculatorThe Indicator calculates the total number of the death and golden crosses in the total chart which can help the moving average user to compare the number of signals generated by the moving average pair in the given timeframe.
If Indicator is not plotting anything then right click on the indicator's scale and click on "Auto(data fits the screen)" option.
Please visit it's previous version if you want to use the indicator on the moving averages created by yourself. Link is here
Trend Following Parabolic Buy Sell Strategy [TradeDots]The Trend Following Parabolic Buy-Sell Strategy leverages the Parabolic SAR in combination with moving average crossovers to deliver buy and sell signals within a trend-following framework.
This strategy synthesizes proven methodologies sourced from various trading tutorials available on platforms such as YouTube and blogs, enabling traders to conduct robust backtesting on their selected trading pairs to assess the strategy's effectiveness.
HOW IT WORKS
This strategy employs four key indicators to orchestrate its trading signals:
1. Trend Alignment: It first assesses the relationship between the price and the predominant trendline to determine the directional stance—taking long positions only when the price trends above the moving average, signaling an upward market trajectory.
2. Momentum Confirmation: Subsequent to trend alignment, the strategy looks for moving average crossovers as a confirmation that the price is gaining momentum in the direction of the intended trades.
3. Signal Finalization: Finally, buy or sell signals are validated using the Parabolic SAR indicator. A long order is validated when the closing price is above the Parabolic SAR dots, and similarly, conditions are reversed for short orders.
4. Risk Management: The strategy institutes a fixed stop-loss at the moving average trendline and a take-profit level determinable by a prefixed risk-reward ratio calculated from the moving average trendline. These parameters are customizable by the users within the strategy settings.
APPLICATION
Designed for assets exhibiting pronounced directional momentum, this strategy aims to capitalize on clear trend movements conducive to achieving set take-profit targets.
As a lagging strategy that waits for multiple confirmatory signals, entry into trades might occasionally lag beyond optimal timing.
Furthermore, in periods of consolidation or sideways movement, the strategy may generate several false signals, suggesting the potential need for additional market condition filters to enhance signal accuracy during volatile phases.
DEFAULT SETUP
Commission: 0.01%
Initial Capital: $10,000
Equity per Trade: 70%
Users are advised to adjust and personalize this trading strategy to better match their individual trading preferences and style.
RISK DISCLAIMER
Trading entails substantial risk, and most day traders incur losses. All content, tools, scripts, articles, and education provided by TradeDots serve purely informational and educational purposes. Past performances are not definitive predictors of future results.
Multiple MAs Signals with RSI MA Filter & Signal About the Script
The "Multiple Moving Averages Signals with RSI MA Filter and Golden Signals" script is a comprehensive trading tool designed to provide traders with detailed insights and actionable signals based on multiple moving averages and RSI (Relative Strength Index). This script combines traditional moving average crossovers with RSI filtering to enhance the accuracy of trading signals and includes "golden" signals to highlight significant long-term trend changes.
This script integrates several technical indicators and concepts to create a robust and versatile trading tool. Here's why this combination is both original and useful:
1. Multiple Moving Averages:
- Why Use Multiple MAs: Different types of moving averages (SMA, EMA, SMMA, WMA, VWMA, Hull) offer unique perspectives on price trends and volatility. Combining them allows traders to capture a more comprehensive view of the market.
- Purpose: Using multiple moving averages helps identify trend direction, support/resistance levels, and potential reversal points.
2. RSI MA Filter:
- Why Use RSI: RSI is a momentum oscillator that measures the speed and change of price movements. It is used to identify overbought or oversold conditions in a market.
- Purpose: Filtering signals with RSI moving averages ensures that trades are taken in line with the prevailing momentum, reducing the likelihood of false signals.
3. Golden Signals:
- Why Use Golden Crosses: A golden cross (50-period MA crossing above the 200-period MA) is a well-known bullish signal, while a death cross (50-period MA crossing below the 200-period MA) is bearish. These signals are widely followed by traders and institutions.
- Purpose: Highlighting these significant long-term signals helps traders identify major buy or sell opportunities and align with broader market trends.
How the Script Works
1. Moving Average Calculations:
- The script calculates multiple moving averages (MA1 to MA5) based on user-selected types (SMA, EMA, SMMA, WMA, VWMA, Hull) and periods (9, 21, 50, 100, 200).
- Golden Moving Averages: Separately calculates 50-period and 200-period moving averages for generating golden signals.
2. RSI and RSI MA Filter:
- RSI Calculation: Computes the RSI for the given period.
- RSI MA: Calculates a moving average of the RSI to smooth out the RSI values and reduce noise.
- RSI MA Filter: Traders can enable/disable RSI filtering and set custom thresholds to refine long and short signals based on RSI momentum.
3. Long & Short Signal Generation:
- Long Signal: Generated when the short-term moving average crosses above both the mid-term and long-term moving averages, and the RSI MA is below the specified threshold (if enabled).
- Short Signal: Generated when the short-term moving average crosses below both the mid-term and long-term moving averages, and the RSI MA is above the specified threshold (if enabled).
4. Golden Signals:
- Golden Long Signal: Triggered when the 50-period golden moving average crosses above the 200-period golden moving average.
- Golden Short Signal: Triggered when the 50-period golden moving average crosses below the 200-period golden moving average.
How to Use the Script
1. Customize Inputs:
- Moving Averages: Choose the type of moving averages and set the periods for up to five different moving averages.
- RSI Settings: Adjust the RSI period and its moving average period. Enable or disable RSI filtering and set custom thresholds for long and short signals.
- Signal Colors: Customize the colors for long, short, and golden signals.
- Enable/Disable Signals: Toggle the visibility of long, short, and golden signals.
2. Observe Plots and Signals:
- The script plots the selected moving averages on the chart.
- Long and short signals are marked with labels on the chart, with customizable colors for easy identification.
- Golden signals are highlighted with specific labels to indicate significant long-term trend changes.
3. Analyze and Trade:
- Use the generated signals as part of your trading strategy. The script provides visual cues to help you make informed decisions about entering or exiting trades based on multiple technical indicators.
Unique Features
1. Integration of Multiple Moving Averages: Combines various moving average types to provide a holistic view of market trends.
2. RSI MA Filtering: Enhances signal accuracy by incorporating RSI momentum, reducing the likelihood of false signals.
3. Golden Signals: Highlights significant long-term trend changes, aligning with broader market movements.
4. Customizability: Offers extensive customization options, allowing traders to tailor the script to their specific trading strategies and preferences.
feel free to comments.
Total Death and Golden Crosses Calculator The Indicator calculates the total number of the death and golden crosses in the total chart which can help the moving average user to compare the number of signals generated by the moving average pair in the given timeframe.
All you need is to plot any two moving average then change the source of the indicator to get the total number of crosses.
If Indicator is not plotting anything then right click on the indicator's scale and click on "Auto(data fits the screen" option.
20,200SMA,PDHL,15 minute ORBSimple Moving Averages (SMAs):
The script calculates three SMAs: SMA 20 High, SMA 20 Low, and SMA 200 Close. These moving averages are widely used in technical analysis to smooth out price data and identify trends.
The SMA for the high price (SMA 20 High) is calculated based on the 20-period moving average of the high prices.
Similarly, the SMA for the low price (SMA 20 Low) is calculated based on the 20-period moving average of the low prices.
The SMA for the close price (SMA 200 Close) is calculated based on the 200-period moving average of the closing prices.
Each SMA is plotted on the chart, and their colors are determined based on whether the current close price is above or below each respective SMA.
Conditional Coloring:
The script employs conditional coloring to visually highlight whether the close price is above or below each SMA.
If the close price is below the SMA 20 High, it's plotted in red; otherwise, it's plotted in green.
Similarly, the SMA 20 Low and SMA 200 Close are plotted with conditional colors based on the relationship between the close price and each respective SMA.
Previous Day's Data:
The script retrieves and plots the high, low, and close prices of the previous trading day.
This provides traders with valuable information about the previous day's market behavior, which can influence trading decisions.
Opening 15-minute Range Breakout:
The script calculates the high and low prices during the first 15 minutes of each trading day.
These prices represent the opening range for the day.
It then determines whether the current close price is above or below this opening range and plots it accordingly.
This breakout strategy helps traders identify potential trading opportunities based on early price movements.
By integrating these components, the script offers traders a comprehensive analysis of market trends, previous day's performance, and potential breakout opportunities. Its originality lies in the combination of these features into a single, easy-to-use indicator, providing valuable insights for trading decisions.
Trailing Take Profit - Close Based📝 Description
This script demonstrates a new approach to the trailing take profit.
Trailing Take Profit is a price-following technique. When used, instead of setting a limit order for the take profit target exiting from your position at the specified price, a stop order is conditionally set when the take profit target is reached. Then, the stop price (a.k.a trailing price), is placed below the take profit target at a distance defined by the user percentagewise. On regular time intervals, the stop price gets updated by following the "Trail Barrier" price (high by default) upwards. When the current price hits the stop price you exit the trade. Check the chart for more details.
This script demonstrates how to implement the close-based Trailing Take Profit logic for long positions, but it can also be applied for short positions if the logic is "reversed".
📢 NOTE
To generate some entries and showcase the "Trailing Take Profit" technique, this script uses the crossing of two moving averages. Please keep in mind that you should not relate the Backtesting results you see in the "Strategy Tester" tab with the success of the technique itself.
This is not a complete strategy per se, and the backtest results are affected by many parameters that are outside of the scope of this publication. If you choose to use this new approach of the "Trailing Take Profit" in your logic you have to make sure that you are backtesting the whole strategy.
⚔️ Comparison
In contrast to my older "Trailing Take Profit" publication where the trailing take profit implementation was tick-based, this new approach is close-based, meaning that the update of the stop price occurs at the bar close instead of every tick.
While comparing the real-time results of the two implementations is like comparing apples to oranges, because they have different dynamic behavior, the new approach offers better consistency between the backtesting results and the real-time results.
By updating the stop price on every bar close, you do not rely on the backtester assumptions anymore (check the Reasoning section below for more info).
The new approach resembles the conditional "Trailing Exit" technique, where the condition is true when the current price crosses over the take profit target. Then, the stop order is placed at the trailing price and it gets updated on every bar close to "follow" the barrier price (high). On the other hand, the older tick-based approach had more "tight" dynamics since the trailing price gets updated on every tick leaving less room for price fluctuations by making it more probable to reach the trailing price.
🤔 Reasoning
This new close-based approach addresses several practical issues the older tick-based approach had. Those issues arise mainly from the technicalities of the TV Backtester. More specifically, due to the assumptions the Broker Emulator makes for the price action of the history bars, the backtesting results in the TV Backtester are exaggerated, and depending on the timeframe, the backtesting results look way better than they are in reality.
The effect above, and the inability to reason about the performance of a strategy separated people into two groups. Those who never use this feature, because they couldn't know for sure the actual effect it might have in their strategy, (even if it turned out to be more profitable) and those who abused this type of "repainting" behavior to show off, and hijack some boosts from the community by boasting about the "fake" results of their strategies.
Even if there are ways to evaluate the effectiveness of the tick-based approach that is applied in an existing strategy (this is out of the topic of this publication), it requires extra effort to do the analysis. Using this closed-based approach we can have more predictable results, without surprises.
⚠️ Caveats
Since this approach updates the trailing price on bar close, you must wait for at least one bar to close after the price crosses over the take profit target.
Johnny's Adjusted BB Buy/Sell Signal"Johnny's Adjusted BB Buy/Sell Signal" leverages Bollinger Bands and moving averages to provide dynamic buy and sell signals based on market conditions. This indicator is particularly useful for traders looking to identify strategic entry and exit points based on volatility and trend analysis.
How It Works
Bollinger Bands Setup: The indicator calculates Bollinger Bands using a specified length and multiplier. These bands serve to identify potential overbought (upper band) or oversold (lower band) conditions.
Moving Averages: Two moving averages are calculated — a trend moving average (trendMA) and a long-term moving average (longTermMA) — to gauge the market's direction over different time frames.
Market Phase Determination: The script classifies the market into bullish or bearish phases based on the relationship of the closing price to the long-term moving average.
Strong Buy and Sell Signals: Enhanced signals are generated based on how significantly the price deviates from the Bollinger Bands, coupled with the average candle size over a specified lookback period. The signals are adjusted based on whether the market is bullish or bearish:
In bullish markets, a strong buy signal is triggered if the price significantly drops below the lower Bollinger Band. Conversely, a strong sell signal is activated when the price rises well above the upper band.
In bearish markets, these signals are modified to be more conservative, adjusting the thresholds for triggering strong buy and sell signals.
Features:
Flexibility: Users can adjust the length of the Bollinger Bands and moving averages, as well as the multipliers and factors that determine the strength of buy and sell signals, making it highly customizable to different trading styles and market conditions.
Visual Aids: The script vividly plots the Bollinger Bands and moving averages, and signals are visually represented on the chart, allowing traders to quickly assess trading opportunities:
Regular buy and sell signals are indicated by simple shapes below or above price bars.
Strong buy and sell signals are highlighted with distinctive colors and placed prominently to catch the trader's attention.
Background Coloring: The background color changes based on the market phase, providing an immediate visual cue of the market's overall sentiment.
Usage:
This indicator is ideal for traders who rely on technical analysis to guide their trading decisions. By integrating both Bollinger Bands and moving averages, it provides a multi-faceted view of market trends and volatility, making it suitable for identifying potential reversals and continuation patterns. Traders can use this tool to enhance their understanding of market dynamics and refine their trading strategies accordingly.
Moving Average Crossover MonitorMoving Average Crossover Monitor: Gain Insight into Market Trends
The Moving Average Crossover Monitor is a specialized tool crafted for traders seeking to understand and predict market trends more effectively. This indicator's primary focus lies in analyzing consecutive candle movements above or below specified moving averages and providing predictive estimates based on historical data.
Key Features:
1. Consecutive Candle Tracking: The indicator meticulously counts and tracks the number of consecutive candles that close above or below a selected moving average (MA1). This tracking offers a tangible measure of trend persistence over time.
2. Historical Analysis for Future Prediction: By analyzing past trends, the indicator provides insights into potential future movements. It estimates the likelihood of upcoming candles continuing above or below the moving average based on historical patterns.
3. Dynamic Visualization: Moving averages (SMA, WMA, EMA) are dynamically plotted on the chart, clearly displaying crossover points and trend transitions.
How It Works:
1. Moving Average Calculation: Select your preferred moving average type (SMA, WMA, EMA) and define short and long periods. The indicator computes two moving averages (MA1 and MA2) based on these parameters.
2. Consecutive Candle Analysis:
- Above MA1: Tracks and counts consecutive candles closing above MA1, indicating potential bullish momentum.
- Below MA1: Tracks and counts consecutive candles closing below MA1, suggesting potential bearish sentiment.
3. Future Trend Prediction: Based on historical data of consecutive candle movements, the indicator estimates the likelihood of the next candle continuing in the same direction (above or below MA1).
Advantages for Traders:
1. Quantitative Insights: Use numerical data on consecutive candles to gauge trend strength and durability.
2. Predictive Analytics: Leverage historical patterns to anticipate future market movements and adjust trading strategies accordingly.
3. Decision Support Tool: Gain clarity on trend transitions, empowering timely and informed trading decisions.
Disclaimer:
This indicator is provided for educational purposes only and should not be considered as financial advice. Trading involves risks, and past performance is not indicative of future results. Traders should conduct their own analysis and exercise caution when making trading decisions based on any indicator or tool. Always consider risk management strategies and consult with a qualified financial advisor if needed.
Coiled Moving AveragesThis indicator detects when 3 moving averages converge and become coiled. This indicates volatility contraction which often leads to volatility expansion, i.e. large price movements.
Moving averages are considered coiled when the percent difference from each moving average to the others is less than the Coil Tolerance % input value.
This indicator is unique in that it detects when moving averages converge within a specified percent range. This is in contrast to other indicators that only detect moving average crossovers, or the distance between price and a moving average.
This indicator includes options such as:
- % difference between the MAs to be considered coiled
- type and length of MAs
- background color to indicate when the MAs are coiled
- arrows to indicate if price is above or below the MAs when they become coiled
While coiling predicts an increased probability for volatility expansion, it does not necessarily predict the direction of expansion. However, the arrows which indicate whether price is above or below the moving average coil may increase the odds of a move in that direction. Bullish alignment of the moving averages (faster MAs above the slower MAs) may also increase the odds of a bullish break, while bearish alignment may increase the odds of a bearish break.
Note that mean reversion back to the MA coil is common after initial volatility expansion. This can present an entry opportunity for traders, as mean reversion may be followed by continuation in the direction of the initial break.
Experiment with different settings and timeframes to see how coiled MAs can help predict the onset of volatility.
On Chart Reverse PMARPIntroducing the On Chart Reverse PMARP
Concept
The PMAR/PMARP is an indicator which calculates :
The ratio between a chosen source price and a user defined moving average ( Price Moving Average Ratio ).
The percentile of the PMAR over an adjustable lookback period ( Price Moving Average Ratio Percentile ).
Here I have 'reverse engineered' the PMAR / PMARP formulas to derive several functions.
These functions calculate the chart price at which the PMARP will cross a particular PMARP level.
I have employed those functions here to give the "crossover" price levels for :
Scale high level
High alert level
High test level
Mid-Line
Low test level
Low alert level
Scale low level
Knowing the price at which these various user defined PMARP levels will be crossed can be useful in setting price levels that trigger components of various strategies.
For example: A trader can use the reverse engineered upper high alert price level, to set a take profit limit order on a long trade, which was entered when PMARP was low.
This 'On Chart' RPMARP indicator displays these 'reverse engineered' price levels as plotted lines on the chart.
This allows the user to see directly on the chart the interplay between the various crossover levels and price action.
This allows for more intuitive Technical Analysis, and allows traders to precisely plan entries, exits and stops for their PMARP based trades.
It optionally plots the user defined moving average from which the PMARP is derived.
It also optionally plots the 'Reverse engineered' midline, test level lines, visual alert level lines, scale max. and min. level lines, and background alert signal bars.
Main Properties :
Price Source :- Choice of price values or external value from another indicator ( default *Close ).
PMAR Length :- User defined time period to be used in calculating the Moving Average for the Price Moving Average Ratio and the PMAR component of the PMARP ( default *21 ).
MA Type :- User defined type of Moving Average which creates the MA for the Price Moving Average Ratio and the PMAR component of the PMARP ( default *EMA ).
Checkbox and color selection box for the optionally plotted Moving Average line.
Price Moving Average Ratio Percentile Properties :
PMARP Length :- The lookback period to be used in calculating the Price Moving Average Ratio Percentile ( default *350 ).
PMARP Level Settings :
Scale High :- Scale high level ( Locked at 100 ).
Hi Alert :- High alert level ( default *99 ).
Hi Test :- High test level ( default *70 ).
Lid Line :- Mid line level ( Locked at 50 ).
Lo Test :- Low test level ( default *30 ).
Lo Alert :- Low alert level ( default *1 ).
Scale Low :- Scale low level ( Locked at 0 ).
Checkboxes and color selection boxes for each of the optionally plotted lines.
PMARP MA Settings :
Checkbox to optionally plot 'reverse engineered' PMARP MA line.
PMARP MA Length :- The time period to be used in calculating the signal Moving Average for the Line Plot ( default *20 ).
PMARP MA Type :- The type of Moving Average which creates the signal Moving Average for the Line Plot ( default *EMA ).
Color Type :- User choice from dropdown between "single" or "dual" line color ( default *dual ).
Single Color :- Color selection box.
Dual Color :- Color selection box. Note: Defines the color of the signal MA when the MA is falling in "dual" line coloring mode.
Signal Bar Settings :
Signal Bars Transparency :- Sets the transparency of the vertical signal bars ( default *70 ).
Checkboxes and color selection boxes for Upper/Lower alert signal bars.
Moving point of controlLibrary "moving_poc"
method getMovingPoc(averagePriceByVolumeHistory, ltfVolumeSerie, ltfPriceSerie, nbBarsToLookback)
Volume point of control (PoC) extracted from lower time frame data and previous time period
Namespace types: array
Parameters:
averagePriceByVolumeHistory (array) : An array of float to record previous PoC average
ltfVolumeSerie (array) : Source of volume for the lower timeframe (ltf)
ltfPriceSerie (array) : Source of price for the lower timeframe
nbBarsToLookback (int) : A number of bars determining the lookback period of this PoC
Returns: Serie of PoC
Johnny's Moving Average RibbonProps to Madrid for creating the original script: Madrid Moving Average Ribbon.
All I did was upgrade it to pinescript v5 and added a few changes to the script.
Features and Functionality
Moving Average Types: The indicator offers a choice between exponential moving averages (EMAs) and simple moving averages (SMAs), allowing users to select the type that best fits their trading strategy.
Dynamic Color Coding: Each moving average line within the ribbon changes color based on its direction and position relative to a reference moving average, providing visual cues for market sentiment and trend strength.
Lime Green: Indicates an uptrend and potential long positions, shown when a moving average is rising and above the longer-term reference MA.
Maroon: Suggests caution for long positions or potential short reentry points, displayed when a moving average is rising but below the reference MA.
Ruby Red: Represents a downtrend, suitable for short positions, shown when a moving average is falling and below the reference MA.
Green: Signals potential reentry points for downtrends or warnings for uptrend reversals, displayed when a moving average is falling but above the reference MA.
Usage and Application
Trend Identification: Traders can quickly ascertain the market's direction at a glance by observing the predominant color of the ribbon and its orientation.
Trade Entry and Exit Points: The color transitions within the ribbon can signal potential entry or exit points, with changes from green to lime or red to maroon indicating shifts in market momentum.
Customization: Users have the flexibility to toggle between exponential and simple moving averages, allowing for a tailored analytical approach that aligns with their individual trading preferences.
Technical Specifications
The ribbon consists of multiple moving averages calculated over different periods, typically ranging from shorter to longer-term intervals to capture various aspects of market behavior.
The color dynamics are determined by comparing each moving average to a reference point, often a longer-term moving average within the ribbon, to assess the relative trend strength and direction.
Trend: SMA with ATR Bands and EMA [Oxyge]Brief introduction:
Easy to use trend indicator to help find entry positions
How it works:
1, short-term trend judgment: EMA is greatly influenced by short-term trends, so it is very good to use it as a tool for judging short-term trends. At the same time, the filtering function has been added:
Long: green
Short: red
No direction: blue
2, the general trend judgment: the use of 30SMA as the default trend line, while increasing the ATR band to increase the scope of judgment.
How do I use (assuming it is now a period of long market):
1, first look at the 30SMA and ATR band, if the slope is positive (> 45 °), then ready to go long!
2. When price comes to the ATR band, the ATR band is my point of interest
3. Wait for a test of the ATR band: the EMA turns green, which means that the short-term trend is already nice and long.
4. Stop Loss Placement: Stop Loss is placed at the most recent low.
Closing
Enjoy it!
——————————————
简单介绍:
简单易用的趋势指标,帮助寻找进场位置
它怎么工作:
1、短期趋势判断:EMA受短期趋势影响很大,因此把它作为判断短期趋势的工具非常好用。同时增加了过滤功能:
多头:绿色
空头:红色
无方向:蓝色
2、大趋势判断:使用30SMA作为默认趋势线,同时增加ATR带增加判断范围。
我是如何使用的(假设是现在是一段多头行情):
1、先看30SMA和ATR带,如果斜率为正(>45°),那么准备做多
2、当价格来到ATR带时,ATR带是我的感兴趣的点
3、等待一次对于ATR带的测试:EMA变成绿色,代表短期已经是不错的多头趋势
4、止损放置:止损放置在最近的低点
结束
请享受它
ChartRage - ELMAELMA - Exponential Logarithmic Moving Average
This is a new kind of moving average that is using exponential normalization of a logarithmic formula. The exponential function is used to average the weight on the moving average while the logarithmic function is used to calculate the overall price effect.
Features and Settings:
◻️ Following rate of change instead of absolute levels
◻️ Choose input source of the data
◻️ Real time signals through price interaction
◻️ Change ELMA length
◻️ Change the exponential decay rate
◻️ Customize base color and signal color
Equation of the ELMA:
This formula calculates a weighted average of the logarithm of prices, where more recent prices have a higher weight. The result is then exponentiated to return the ELMA value. This approach emphasizes the relative changes in price, making the ELMA sensitive to the % rate of change rather than absolute price levels. The decay rate can be adjusted in the settings.
Comparison EMA vs ELMA:
In this image we see the differences to the Exponential Moving Average.
Price Interaction and earlier Signals:
In this image we have added the bars, so we can see that the ELMA provides different signals of resistance and support zones and highlights them, by changing to the color yellow, when prices interact with the ELMA.
Strategy by trading Support and Resistance Zones:
The ELMA helps to evaluate trends and find entry points in bullish market conditions, and exit points in bearish conditions. When prices drop below the ELMA in a bull market, it is considered a buying signal. Conversely, in a bear market, it serves as an exit signal when prices trade above the ELMA.
Volatile Markets:
The ELMA works on all timeframes and markets. In this example we used the default value for Bitcoin. The ELMA clearly shows support and resistance zones. Depending on the asset, the length and the decay rate should be adjusted to provide the best results.
Real Time Signals:
Signals occur not after a candle closes but when price interacts with the ELMA level, providing real time signals by shifting color. (default = yellow)
Disclaimer* All analyses, charts, scripts, strategies, ideas, or indicators developed by us are provided for informational and educational purposes only. We do not guarantee any future results based on the use of these tools or past data. Users should trade at their own risk.
This work is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
creativecommons.org
Leading T3Hello Fellas,
Here, I applied a special technique of John F. Ehlers to make lagging indicators leading. The T3 itself is usually not realling the classic lagging indicator, so it is not really needed, but I still publish this indicator to demonstrate this technique of Ehlers applied on a simple indicator.
The indicator does not repaint.
In the following picture you can see a comparison of normal T3 (purple) compared to a 2-bar "leading" T3 (gradient):
The range of the gradient is:
Bottom Value: the lowest slope of the last 100 bars -> green
Top Value: the highest slope of the last 100 bars -> purple
Ehlers Special Technique
John Ehlers did develop methods to make lagging indicators leading or predictive. One of these methods is the Predictive Moving Average, which he introduced in his book “Rocket Science for Traders”. The concept is to take a difference of a lagging line from the original function to produce a leading function.
The idea is to extend this concept to moving averages. If you take a 7-bar Weighted Moving Average (WMA) of prices, that average lags the prices by 2 bars. If you take a 7-bar WMA of the first average, this second average is delayed another 2 bars. If you take the difference between the two averages and add that difference to the first average, the result should be a smoothed line of the original price function with no lag.
T3
To compute the T3 moving average, it involves a triple smoothing process using exponential moving averages. Here's how it works:
Calculate the first exponential moving average (EMA1) of the price data over a specific period 'n.'
Calculate the second exponential moving average (EMA2) of EMA1 using the same period 'n.'
Calculate the third exponential moving average (EMA3) of EMA2 using the same period 'n.'
The formula for the T3 moving average is as follows:
T3 = 3 * (EMA1) - 3 * (EMA2) + (EMA3)
By applying this triple smoothing process, the T3 moving average is intended to offer reduced noise and improved responsiveness to price trends. It achieves this by incorporating multiple time frames of the exponential moving averages, resulting in a more accurate representation of the underlying price action.
Thanks for checking this out and give a boost, if you enjoyed the content.
Best regards,
simwai
---
Credits to @loxx
DynamicMAsLibrary "DynamicMAs"
Custom MA's that allow a dynamic calculation beginning from the first bar, irrespective of lookback period.
SMA(src, length)
Dynamic SMA
Parameters:
src (float)
length (int)
EMA(src, length)
Dynamic EMA
Parameters:
src (float)
length (int)
DEMA(src, length)
Dynamic DEMA
Parameters:
src (float)
length (int)
TEMA(src, length)
Dynamic TEMA
Parameters:
src (float)
length (int)
WMA(src, length)
Dynamic WMA
Parameters:
src (float)
length (int)
HMA(src, length)
Dynamic HMA
Parameters:
src (float)
length (int)
VWMA(src, length)
Dynamic VWMA
Parameters:
src (float)
length (int)
SMMA(src, length)
Dynamic SMMA
Parameters:
src (float)
length (int)
LSMA(src, length)
Dynamic LSMA
Parameters:
src (float)
length (int)
ALMA(src, length, offset_sigma, sigma)
Dynamic ALMA
Parameters:
src (float)
length (int)
offset_sigma (float)
sigma (float)
HyperMA(src, length)
Dynamic HyperbolicMA
Parameters:
src (float)
length (int)
Normalised Gaussian MACD Heikin Ashi [AlgoAlpha]🌟🚀Introducing the Normalised Gaussian MACD Heikin Ashi by AlgoAlpha !
Elevate your trading game with this multipurpose indicator, crafted to pinpoint trend continuation opportunities while highlighting volatility and oversold/overbought conditions. Whether you're embarking on your trading journey or you're a seasoned market navigator, this tool is equipped with intuitive visual cues to amplify your decision-making prowess and enrich your market analysis toolkit. Let's dive into the key features, utilization strategies, and the innovative logic underpinning this indispensable trading asset.
Key Features:
🔧 Enhanced Customization : Tailor your experience with adjustable parameters including Fast Length, Slow Length, Source, Macd Smoothing Length, Signal Smoothing, and more.
🖌️ Visual Enhancements : Opt for Heikin Ashi Candles display and choose to show or hide MACD and Signal lines for a clutter-free chart.
🌈 Color Customization : Personalize your chart with selectable primary and secondary up and down colors to suit your visual preferences.
🔔 Advanced Alert System : Stay ahead with comprehensive alert conditions for market movements, including trend reversals, bullish and bearish swings.
How to Use:
Configure the Inputs : Start by customizing the indicator’s settings to match your trading style. Adjust the length parameters, source selection, and smoothing lengths to fine-tune the indicator’s sensitivity.
Interpret the Candles and Colors : Keep an eye on the Heikin Ashi Candles (if enabled) and the color shifts within the MACD Line Candles and Histogram. These visual cues are pivotal for identifying market trends.
Analyze with Flexibility : Make use of the option to display or hide the MACD and Signal lines based on your analysis requirements. This can help in focusing on the essential information without overcrowding your chart.
Utilize Alerts for Timely Decisions : Leverage the extensive alert system to get notified about potential market movements. These alerts can help you capture the right moment to enter or exit trades.
Basic Logic:
The Normalised Gaussian MACD Heikin Ashi by AlgoAlpha integrates Gaussian filters to elevate the traditional MACD indicator's efficiency, providing a more detailed analysis of market trends and momentum. This sophisticated approach reduces noise and enhances signal speed, which is crucial for identifying momentum trading opportunities.
Gaussian Filter Implementation : The core innovation lies in applying a Gaussian filter to the input price series. This mathematical technique smooths the price data, significantly reducing market noise and making trend signals clearer and more reliable. The Gaussian filter calculates a smoothed value for each data point by weighting nearby data points, with the weights decreasing as the distance from the current data point increases.
Refined MACD Calculation : The Gaussian MACD is derived from the difference between two Gaussian smoothed moving averages (fast and slow), which are then normalized to account for market volatility. This normalization process involves dividing the difference by a measure of market range (such as the high minus the low), and multiplying by a factor (usually 100) to scale the indicator appropriately.
🔑 This script is a versatile tool designed to aid in the identification of momentum and reversals, helping traders to make informed decisions based on technical analysis. Its customization options allow for a tailored analysis experience, fitting the unique needs and strategies of each trader.
series_collectionLibrary "series_collection"
A personal collection of commonly used series types like moving averages that are supported directly by
the pinescript library ('ALMA', 'DEMA', 'EMA', 'HMA', 'RMA', 'SMA', 'SWMA', 'VWMA', 'WMA'), highest and lowest source,
median and pivots. One single function (with overloads) that can be configured easily by the user input and can be
used as a core piece of functionality for many user cases. This library was created to abstract away and re-use this
commonly used functionality in my "Two MA Signal Indicator" script and the "Template Trailing Strategy" script. Both
of them use the "two_ma_logic" for defining entry and exit signals. While this piece of work does not contain any
novel mathematical expressions and just adds a convinient (and configurable) way to do things, I hope that might add
value to other scripts as well and future projects.
cust_series(length, seriesType, source)
cust_series - Calculate the custom series of the given source for the given length and type
Parameters:
length (simple int) : - The length of the custom series
seriesType (simple string) : - The type of the custom series
source (float) : - The source of the values
Returns: - The resulting value of the calculations of the custom series
cust_series(length, seriesType, source)
cust_series - Calculate the custom series of the given source for the given length and type
Parameters:
length (simple float) : - The length of the custom series (ceiled)
seriesType (simple string) : - The type of the custom series
source (float) : - The source of the values
Returns: - The resulting value of the calculations of the custom series
EMA + Lower Timeframe EMA (correct display in Replay Mode)This indicator shows
one EMA for the current timeframe
one EMA for a lower timeframe
Unlike the built-in Tradingview EMA indicator, this indicator shows the correct values for the lower timeframe EMA during Replay Mode.