Simple Moving Average Slope [AstrideUnicorn]The Simple Moving Average Slope indicator (SMAS) is a technical analysis tool designed to help traders detect the direction and strength of the current trend in the price of an asset. It is also a great tool for identifying sideways markets. The indicator plots the slope of a simple moving average (SMA) of the closing prices over a specified time period. The slope is normalized by dividing it by the standard deviation of the slope over a longer time period.
HOW TO USE
Traders can use the Simple Moving Average Slope indicator in various ways. One common way is to look for bullish or bearish signals. A bullish signal occurs when the normalized slope rises above a predetermined threshold, resulting in the indicator turning green, indicating an upward trend in the market. Conversely, a bearish signal is generated when the normalized slope falls below the negative value of the threshold, causing the indicator to turn red, signaling a downtrend in the market. When the normalized slope falls between the positive and negative threshold values, a neutral signal is generated, indicating that the market is moving sideways. This can help traders avoid false trend signals from other indicators and strategies that may occur when the market is in a sideways regime. Additionally, traders can use the Simple Moving Average Slope indicator in conjunction with other technical indicators to confirm the trend direction.
SETTINGS
Window - specifies the number of bars used to calculate the SMA slope. The default value is 20.
Threshold - specifies the threshold value used to generate the bullish and bearish signals. The default value is 0.6. Traders can adjust these settings based on their trading strategy and the asset being analyzed.
Moyennes mobiles
Aggregate Medians [wbburgin]This indicator recursively finds the average of all high/low medians under your chosen length. This can be very, very helpful for analyzing trends where a moving average or a normal median would produce a bunch of false signals.
Settings:
The "Length" setting is the maximum median that you want the algorithm to add into the sum. The "Start at Period" setting is the the minimum median that you want the algorithm to take into account. Starting at a higher period means that the faster, more sensitive medians of lower lengths are not included, and will smooth out your curve.
I haven't seen many recursive algorithms on TradingView so feel free to use this script as inspiration for any of your ideas. In theory, you can essentially replace the median function with any other function - a moving average, a supertrend, or anything else.
The start must be lower than the length, because this is a sum from the start to the length of all medians in between.
EMA + ATR Support and Resistance + Take Profit SignalThe 'EMA+ ATR Support Resistance Take Profit signal' indicator is a technical analysis tool designed to help traders identify potential support and resistance levels, using the Exponential Moving Average (EMA) and the Average True Range (ATR) indicators. This indicator not only tracks the EMA and ATR but also plots these levels as support and resistance lines, providing useful insights into potential buy and sell points.
The indicator allows you to set the lengths for both the EMA and ATR, with default values set to 20 and 14, respectively. Moreover, you can specify the multiplier for the ATR in the Support/Resistance (S/R) length setting, which defaults to 2. The line width for the plotted lines can also be adjusted according to your preference.
The EMA line in center is invisible by default but you can change that by going to the setting of the indicator. The support and resistance lines are plotted in green and red, respectively. When the price hits the support or resistance levels, the indicator provides a visual signal with a cross shape below or above the respective bars, in lime and red, respectively. If you do not need the take profit signals you can disable them in the setting.
How to Use:
1. Define the EMA and ATR lengths according to your trading strategy. Higher lengths will provide smoother lines but may also lag the current price action.
2. Set the S/R length to determine the distance of the support and resistance lines from the EMA line. Higher values will place these lines further away from the EMA.
3. Monitor the chart for instances when the price hits the support or resistance levels. This is indicated by a cross shape below (for support hit) or above (for resistance hit) the price bar. These points may be considered as potential take profit points or entry/exit points, depending on your strategy.
4. Use the indicator in conjunction with other tools and indicators to confirm signals and reduce the risk of false signals. So the assumption is you enter a trade using your other indicators but you can rely on this indicator to remind you to take profit if you are long by a red cross of the resistance line and if you are short reminds you by a green cross on the support line.
Disclaimer: This indicator should not be used as the sole determinant for any investment decision. Always conduct thorough research and consider multiple factors before trading.
Display Trade Volume with MA Angle and Price VelocityThis Pine Script indicator is designed to provide traders with a visual representation of trade volume, moving average (MA) angle, and price velocity on a chart. The primary components of this indicator are:
Trade Volume: The indicator compares the current bar's trade volume with the average volume over a user-defined lookback period. The volume is displayed as either "Low" or "Trade" in a table, with red or green background color, respectively, to indicate whether it's below or above the average volume.
MA Angle: The indicator calculates the angle of the moving average (either Simple, Exponential, or Hull) over a user-defined length. A positive angle is shown in green, while a negative angle is shown in red. The angle is displayed in degrees in the table.
Price Velocity: This component calculates the velocity of price movement by comparing the difference between high and low prices over a user-defined lookback period. It then displays the velocity as either "Slow" or "Fast" in the table, with red or green background color, respectively, depending on whether it's below or above the average difference.
The indicator also includes alert conditions for high and low volume situations, notifying the trader when the current bar's volume is significantly higher or lower than the average volume.
User Defined Momentum Change with Swing VisualsThis script is a groundbreaking, math-centric technical analysis tool that blends two well-established indicators, the Stochastic Oscillator and the Exponential Moving Average (EMA), to deliver a unique and visually engaging way of identifying momentum swings and stochastic indicators. Unlike mashups, this script is tailored to accommodate a wide range of trading strategies, providing traders with a distinctive perspective on market trends.
The innovation in this script lies in its mathematically-driven ability to effectively combine the Stochastic Oscillator and EMA, setting it apart from other available tools that simply offer a rehash of old ideas or slight modifications to popular indicators. The EMA is employed instead of a Simple Moving Average (SMA), enhancing the uniqueness of the calculations. This novel approach creates a new dimension for traders to evaluate potential momentum swings and visualize them on the chart, proving it to be more than just a mere mashup of existing indicators.
Central to the script's utility is its extensive customization options, which allow traders to adjust various inputs to suit their preferences and trading strategies. Users can modify the EMA length, swing range signal offsets, and smoothing factors for both the fast and slow components of the Stochastic Oscillator. Additionally, the script offers the ability to personalize the color thresholds, transparency, and line properties for the Stochastic Oscillator and swing range signal.
This script's visually dynamic representation of momentum swings empowers traders to make more informed trading decisions, particularly on the 6-hour timeframe. The swing range signal, represented by vertical lines on the chart, acts as a valuable visual aid for identifying potential entry or exit points. Furthermore, the Stochastic Oscillator provides insights into the strength and direction of momentum, which is beneficial for confirming potential trade signals.
To conclude, this script is not just another combination of MAs or a slightly modified version of a popular indicator. Instead, it offers traders a comprehensive, visually appealing, and customizable tool for technical analysis, which is both original and useful. By uniquely combining the EMA and the Stochastic Oscillator with a strong mathematical foundation, and allowing traders to adjust a variety of settings, this script adds value to the TradingView community and enhances the body of knowledge available for traders. It is designed to support traders in tailoring their analysis based on their own strategies and preferences, enabling them to make well-informed decisions in the financial markets.
Momentum-Adjusted Volatility Ratio (MAVR)The Momentum-Adjusted Volatility Ratio (MAVR) indicator is designed to help you understand the strength of price movements relative to the market's volatility. It combines the concepts of rate of change (ROC) and average true range (ATR) and then calculates their ratio, which is then smoothed using an exponential moving average (EMA). Here's a general guide on how to use the MAVR indicator:
Identify the trend: Look for the overall direction of the EMA of the MAVR. When the EMA is above the zero line, it indicates that the momentum is positive and the trend is generally bullish. Conversely, when the EMA is below the zero line, it indicates that the momentum is negative, and the trend is generally bearish.
Assess momentum strength: Pay attention to the distance between the EMA of the MAVR and the zero line. A larger distance indicates a stronger momentum, while a smaller distance suggests weaker momentum. If the EMA of the MAVR moves further away from the zero line, it indicates that the price movement is becoming more robust relative to the market's volatility.
Look for potential entry and exit signals: When the EMA of the MAVR crosses the zero line, it could provide a potential trading signal. For instance, a cross from below to above the zero line may indicate a potential buying opportunity, while a cross from above to below the zero line may signal a potential selling opportunity. Keep in mind that the MAVR indicator should not be used in isolation, and it's essential to combine it with other technical analysis tools and risk management techniques.
Monitor for divergences: Sometimes, the price and the EMA of the MAVR can show divergences. For example, if the price makes a higher high while the EMA of the MAVR makes a lower high, it could signal a bearish divergence, suggesting a potential trend reversal. Similarly, if the price makes a lower low while the EMA of the MAVR makes a higher low, it could indicate a bullish divergence, suggesting a possible trend reversal.
Remember that no indicator is perfect, and the MAVR should be used in conjunction with other technical analysis tools and a solid trading strategy to increase the chances of success. Always use proper risk management techniques to protect your capital.
ATR Adaptive EMA (AEMA)In the world of trading, it's essential to stay ahead of the curve and adapt to the ever-changing market conditions. One of the key aspects of successful trading is using the right tools to analyze and predict market trends. Traditional moving averages, such as the exponential moving average (EMA), have been a staple of technical analysis for decades. However, the limitations of fixed EMA lengths have prompted traders to look for more adaptable and dynamic alternatives. This is where our innovative Adaptive EMA Length Indicator, based on ATR, comes into play.
An Overview of the Adaptive EMA Length Indicator
Our Adaptive EMA Length Indicator is a powerful and versatile tool that utilizes the Average True Range (ATR) to dynamically determine the ideal EMA length based on current market conditions. This unique approach offers traders an edge by providing a more accurate representation of market trends, enabling them to make more informed trading decisions.
Key Features of the Adaptive EMA Length Indicator
Utilizing ATR for Enhanced Volatility Analysis: The Average True Range (ATR) is a well-established measure of market volatility. By incorporating ATR in our indicator, we ensure a more accurate representation of market conditions, allowing traders to better adapt their strategies to the prevailing volatility levels.
Customizable Parameters: Our Adaptive EMA Length Indicator allows traders to adjust key parameters, such as minimum and maximum EMA lengths, ATR length, outlier length, and outlier deviation level. This level of customization gives traders the ability to fine-tune the indicator according to their trading style and preferences.
Versatile Application Across Markets: The Adaptive EMA Length Indicator is designed to work with various financial markets, including stocks, commodities, and cryptocurrencies. Its versatility makes it a valuable addition to any trader's toolkit, regardless of their chosen market.
How to Use the Adaptive EMA Length Indicator
Set your preferred parameters: Begin by adjusting the minimum and maximum EMA lengths, ATR length, outlier length, and outlier deviation level to fit your trading style.
Apply the indicator to your chosen market: Add the Adaptive EMA Length Indicator to your chart and observe the dynamic EMA line adjusting based on current market conditions.
Use the dynamic EMA for trade entry and exit points: Monitor the EMA line in relation to the price action. When the price crosses the EMA line from below, consider it a potential buy signal. Conversely, when the price crosses the EMA line from above, it could indicate a sell signal. However, it's crucial to consider other technical analysis tools and market factors before making any trading decisions.
Continuously assess and adjust: As with any trading strategy, it's essential to keep monitoring market conditions and adjusting your parameters accordingly. Stay vigilant and be prepared to adapt your strategy as needed.
Our Adaptive EMA Length Indicator, based on ATR, offers a revolutionary approach to determining the ideal EMA length. By providing a more accurate representation of market trends, this innovative tool empowers traders to make better-informed decisions and stay ahead of the market. Try it out for yourself and see why it's a game-changer for traders seeking adaptable, dynamic, and effective trading strategies.
EMA bridge and dashboard with color coding.
Summary:
This is a custom moving average indicator script that calculates and plots different Exponential Moving Averages (EMAs) based on user-defined input values. The script also displays MACD and RSI, and provides a table that displays the current trend of the market in a color-coded format.
Explanation:
- The script starts by defining the name of the indicator and the different inputs that the user can customize.
- The inputs include bridge values for three different EMAs (high, close, and low), and four other EMAs (5, 50, 100, and 200).
- The script assigns values to these inputs using the `ta.ema()` function.
- Additionally, the script calculates EMAs for higher timeframes (3m, 5m, 15m, and 30m).
- The script then plots the EMAs on the chart using different colors and line widths.
- The script defines conditions for going long or short based on the crossover of two EMAs.
- It plots triangles above or below bars to indicate the crossover events.
- The script also calculates and displays the RSI and MACD of the asset.
- Finally, the script creates a table that displays the current trend of the market in a color-coded format. The table can be positioned on the top, middle, or bottom of the chart and on the left, center, or right side of the chart.
Parameters:
- i_ema_h: Bridge value for high EMA (default=34)
- i_ema_c: Bridge value for close EMA (default=34)
- i_ema_l: Bridge value for low EMA (default=34)
- i_ema_5: Value for 5-period EMA (default=5)
- i_ema_50: Value for 50-period EMA (default=50)
- i_ema_100: Value for 100-period EMA (default=100)
- i_ema_200: Value for 200-period EMA (default=200)
- i_f_ema: Value for fast EMA used in MACD calculation (default=9)
- i_s_ema: Value for slow EMA used in MACD calculation (default=21)
- fastInput: Value for fast length used in MACD calculation (default=7)
- slowInput: Value for slow length used in MACD calculation (default=14)
- tableYposInput: Vertical position of the table (options: top, middle, bottom; default=middle)
- tableXposInput: Horizontal position of the table (options: left, center, right; default=right)
- bullColorInput: Color of the table cell for a bullish trend (default=green)
- bearColorInput: Color of the table cell for a bearish trend (default=red)
- neutColorInput: Color of the table cell for a neutral trend (default=white)
- neutColorLabelInput: Color of the label for neutral trend in the table (default=fuchsia)
Usage:
To use this script, simply copy and paste it into the Pine Editor on TradingView. You can then customize the input values to your liking or leave them at their default values. Once you have added the script to your chart, you can view the EMAs, MACD, RSI, and trend table on the chart. The trend table provides a quick way to assess the current trend of the market at a glance.
Adaptive MACDIntroducing the "Adaptive MACD" indicator, an innovative and user-friendly script that utilizes the PeacefulIndicators library to provide traders with a dynamic and responsive version of the classic MACD indicator. This script effectively adapts the MACD calculation to account for the dominant market cycle, offering improved signals to help you make better-informed trading decisions.
The Adaptive MACD indicator incorporates the following features:
A selection of customizable input parameters, allowing you to adjust the short length, long length, signal length, and the dynamic high and low values to suit your individual trading preferences.
A visually appealing and informative display, using different colors to highlight MACD line crossovers and histogram bars, making it easier to interpret the indicator's signals.
The core functionality of the Adaptive MACD is powered by the macdDynamicLength function from the PeacefulIndicators library, ensuring accurate and reliable calculations.
To start using the Adaptive MACD indicator in your trading analysis, simply add the script to your chart, and customize the input parameters as needed. We hope this script, built upon the PeacefulIndicators library, proves to be a valuable addition to your trading strategy.
Higher TimeFrame Smooth Moving AveragesScript is designed for those who dislike how plotting a moving average from a higher timeframe on a lower timeframe chart results in a choppy zigzag line when using the standard request.security(syminfo.ticker,"x",ta.sma(src,len)) method.
My more elegant solution was to translate the chart's current timeframe, and the selected higher timeframe into seconds, then check if selected timeframe is Larger than chart timeframe, but not so large that too many bars would be necessary. Then the quotient is calculated by dividing the chosen timeframe (value in seconds) by the chart's timeframe (value in seconds).
Then take that quotient and multiply it by the chosen length. This gives us how many bars of the chart's timeframe would be used in calculating the higher timeframe Moving Average
Use the value to calculate a moving average of choice (SMA,EMA,WMA,LRC,DEMA,TEMA,TRIMA,FRAMA) thanks to @TradingView 's ta library () and @alexgrover 's () for their functions supporting series as length, making this possible.
Basically, get how many of the current chart's bars are in the higher timeframe moving average and use that as the length for calculation using chart's timeframe.
If the higher timeframe relative is too large relative to chart's timeframe, due to bar referencing limits some combinations may not be possible under current limitations, but most will work by either moving chart's timeframe higher or higher timeframe lower assuming you aren't trying to do something too extreme like plotting a weekly moving average onto a 30 second chart etc.
Advanced Price Direction bar colorsIn the advanced price direction algorithm situations of faltering price directions (fda) are identified.
These are very interesting, because this happens at tops, flags and trend turns.
I got the idea of coloring the bars with fda in a distinguishing color, reddish gray for fda down and blueish gray for faltering up.
The remaining bars retain standard color, but now this color 'confirms' the trend.
To show that this is true, I also plot a simple moving average (sma) with the same length in the chart.
It turns out that somehow the bars react to being above or below the sma, but also react to the direction of the sma.
Very interesting.
Have fun
KDJ Indicator with RSI FilterThe KDJ indicator is a technical analysis tool used by traders to identify potential buy and sell signals in financial markets. It is an extension of the Stochastic Oscillator, which consists of two lines, %K and %D, that move within a range of 0 to 100. The KDJ indicator introduces a third line, called %J, which is derived from the %K and %D lines. The KDJ indicator is primarily used to identify overbought and oversold conditions, as well as potential trend reversals.
Here's a brief overview of the KDJ indicator's components:
%K line: It is calculated by comparing the current closing price to the range of high and low prices over a specific period (usually 9 days).
%D line: It is a moving average of the %K line
%J line: It is calculated using the %K and %D lines
The KDJ indicator generates buy signals when the %K line crosses above the %D line and sell signals when the %K line crosses below the %D line. Additionally, when the %J line is above 100, it suggests that the asset is overbought, and when the %J line is below 0, it suggests that the asset is oversold. Traders often use these overbought and oversold signals to identify potential trend reversals.
I have taken KDJ script from and added RSI filter and alerts with and without RSI filter.
I was requested to create this script with alerts. And here it is. I have added alerts. And, I have added abilities to turn on and off the RSI filters from settings.
BB_MDL_V1Simple indicator that is based on the average line of the bollinger bands and the exponential average of 200 periods.
The customizable variable is bollinger bands length, currently the default is 35, you can tweak it to your liking and see how trend identification changes.
My recommendation is to work in 5-minute time frames in values such as SOL, FTM or MASK (cryptos)
This simple strategy can be combined with many others to gain more insight and get better market entries and exits.
[blackcat] L1 An Adaptive Moving Average For Swing TradingLevel 1
Background
Scott Cong published an article of “An Adaptive Moving Average For Swing Trading” on April 2023. I rewrite it for pine script.
Function
In "An Adaptive Moving Average For Swing Trading," author Scott Cong introduces a new adaptive moving average that is designed to be responsive, smooth, and robust. He begins with a discussion of Perry Kaufman's adaptive moving average and explains how an adaptive moving average (AMA) can adapt to different market environments. Later he explains his methods of adjusting and changing the smoothing factor, which has better response than traditional EMA and SMA. I rewrited this new kind of moving average in pine script and use yellow color for its fast line while fuchsia color for its trigger signal as a slow line. By the way, divergence detector is also added for divergence notification. You can change period or length, and signal source parameters in setting dialog.
Remarks
Feedbacks are appreciated.
Universal MA Trend(Republishing in Open source)
Hello traders,
Many existing moving average indicators have not been satisfactory in terms of the number, types, and length adjustments of moving averages.
Feeling the inconvenience, I created a moving average indicator and collected numerous famous moving averages.
Fortunately, there was a PineCoder "andre_007" who had already compiled various Moving Averages,
so I was able to find a new Moving Average and combine it with the indicator. Here is the link below
Among these, for the JMA, which has not been publicly disclosed, I utilized the source code from TradingView Wizard everget:
For VIDYA, I also used everget's source code:
And also MAMA / FAMA Coded from Pinescript Wizard everget :
Ehlers MESA Adaptive Moving Averages (MAMA & FAMA)
For Frama, I used the code from nemozny's source code :
Thanks to all these Pinecoders.
---
By using these excellent moving averages together, I found that the simultaneous Up/Down changes of various moving averages with different characteristics tend to be maintained for quite a long time.
Therefore, this indicator not only collects various moving averages but also displays areas with simultaneous trends as background.
An example can be found here:
Furthermore, to prevent the up/down changes of the moving averages due to factors like whipsaws, a smoothing filter has been introduced.
And Also, Alert is able when trend changes.
---
(오픈소스화 후 재발행)
안녕하세요 트레이더여러분.
기존의 이동평균선 지표들은, 이동평균선의 갯수, 종류, 길이조절 등에서 만족스럽지 못한 점들이 많았습니다.
불편함을 느끼고 직접 이동평균선 지표를 만들면서, 유명한 수 많은 이동평균선들을 모았습니다.
그리고 이미 이러한 수많은 이동평균선을 손수 모아서 정리해주신 고마우신 파인코더(andere_007 님)가 있어서, 그 분의 코드를 많이 이용했습니다. 링크는 아래와 같습니다.
이 중 소스가 공개되지 않은 이동평균선 중 JMA는 트레이딩뷰 위자드이신 everget의 소스코드를 이용했습니다.
VIDYA 역시 everget의 소스코드를 이용했습니다.
MAMA와 FAMA의 코드 역시 everget님의 코드를 가져왔습니다.
Ehlers MESA Adaptive Moving Averages (MAMA & FAMA)
Frama는 nemozny님의 코드를 이용했습니다.
의 코드를 이용했습니다.
이 자리를 빌어 위의 파인코더님들께 감사의 말씀을 전합니다.
---
이러한 좋은 이동평균선을 모아서 사용해보니, 다양한 특성을 갖고 있는 이동평균선의 동시적인 Up/Down 변화는 꽤 오랫동안 유지된다는 점을 발견했습니다.
그래서 이 지표는, 위의 여러가지 이동평균선을 모아놓은 것 뿐만 아니라,
그것에서 동시적인 트랜드가 나오는 곳을 배경화면으로 표시해두었습니다.
예시는 다음과 같습니다.
나아가 휩쏘 등으로 이동평균선의 up/down이 바뀌는 것을 막고자, Smoothing 필터도 도입했습니다.
또한 트랜드가 바뀔 때 얼러트가 울리도록, 얼러트 기능을 설정해놓을 수 있게 해놓았으며, 현재 이동평균선과 상태를 보기 쉽도록 테이블을 만들어놓았습니다.
Optimized Zhaocaijinbao strategyIntroduction:
The Optimized Zhaocaijinbao strategy is a mid and long-term quantitative trading strategy that combines momentum and trend factors. It generates buy and sell signals by using a combination of exponential moving averages, moving averages, volume and slope indicators. It generates buy signals when the stock is above the 35-day moving average, the trading volume is higher than the 20-day moving average, and the stock is in an upward trend on a weekly timeframe."招财进宝" is a Chinese phrase that can be translated to "Attract Wealth and Bring in Treasure" in English. It is a common expression used to wish for good luck and prosperity in various contexts, such as in business or personal finances.
Highlights:
The strategy has several special optimizations that make it unique.
Firstly, the strategy is optimized for T+1 trading in the Chinese stock market and is only suitable for long positions. The optimizations are also applicable to international stock markets.
Secondly, the trend strategy is optimized to only show indicators on the right side and oscillations. This helps to prevent false signals in choppy markets.
Thirdly, the strategy uses a risk factor for dynamic position sizing to ensure position sizes are adjusted according to the current net asset value and risk preferences. This helps to lower drawdown risks.
The strategy has good resilience even without using stop loss modules in backtesting, making it suitable for trading hourly, 2-hourly, and daily K-line charts (depending on the stock being traded). We recommend experimenting with backtesting using SSE 1-hour or 2-hour or daily Kline charts.
Backtesting outcomes:
The strategy was backtested over the period from October 13th, 2005 to April 14th, 2023, using daily candlestick charts for the commodity code SSE:600763, with a currency of CNY and tick size of 0.01. The strategy used an initial capital of 1,000,000 CNY, with order sizes set to 10% equity and a pyramid of 1 order. The strategy also had a Max Position Size of 0.01 and a Risk Factor of 2.
Here is a summary of the performance of the trading strategy:
Total net profit: 288,577.32 CNY, representing a return of 128.86%
Total number of closed trades: 61
Winning trades: 37, representing a win rate of 60.66%
Profit factor: 2.415
Largest losing trade: 222,021.46 CNY, representing a loss of 14.08%
Average trade: 21,124.22 CNY, representing a return of 3.1%
Average holding period for all trades: 12 days
Conclusion:
In conclusion, the Optimized Zhaocaijinbao strategy is a mid and long-term quantitative trading strategy that combines momentum and trend factors. It is suitable for both Chinese stocks and global stocks. While the Optimized Zhaocaijinbao strategy has performed well in backtesting, it is important to note that past performance is not a guarantee of future results. Traders should conduct their own research and analysis and exercise caution when using any trading strategy.