Automatic TrendlinesIntroduction
For a full free tutorial explaining this code in more detail, visit the backtest-rookies (.com) website.
This indicator will plot two trend lines at any given time. A resistance trend line and a support trend line. The resistance trend is shown with red circles and is created by joining swing highs together. The second is a support trend which is created by joining swing lows.
Since we need swings to make the trend, the trend line code contains code for the swing detection. You can play around with the swing detection to alter how frequently new trend lines are detected. Relying on swings also means that there will be some delay in trend detection depending on how you configure the swing detection. The higher you set rightbars, the more lag you will have before a trend is detected. However, at the same time the quality of the pivots found will increase. So it is a trade-off you need to come to terms with and decide what the best settings are for you.
Lines
A single trend line is made up of several components.
Pivot Points: Marked as blue or orange circles. There will be two pivots per trend.
Orange/Purple Lines: Connecting all pivot points. You will see these lines change direction slightly each time a new pivot is detected (new circles appear).
Green/Red Circle lines: Showing the trend line from the earliest moment a new trend is detected.
Blue Dashed lines: Joining the purple and green/red circle lines so the full trend line can be seen.
Note: The blue dashed lines use pine-scripts drawing functions. As such, there is a limit to how many of these can be placed on a chart. When the limit is reached, the oldest line will be removed so the newest can be drawn. This means that if you detect enough trends and scroll back in time, the blue dashed lines will disappear at some point!
Cari dalam skrip untuk "trend"
TAI - Trend Agreement IndexThe TAI is an experimental indicator we created to begin working on a automated trading algorithm. It takes five signals from our indicators and gives a +1 or -1 for each signal depending on if the signal is bullish or bearish.
This indicator should not be used for direct signals, but for confluence in trend. Long periods of flatness at 5 or -5 will indicate a very strong trend in that direction.
The TAI gives 4 different arrows depending on what the trend is doing.
Blue = Uptrend
Red = Uptrend Lost
Orange = Downtrend
Green = Downtrend Lost
This is a free add-on indicator for traders with access to the DBT MoMo and the Oasis Trading Suite and Bundle Package.
For Access or Questions: Private message us. Thank you.
Trendless MACD Strategy (Trendless Strategy Series -1 )I Try to eliminate the trend of the stock to see a clear version of the indicators. If you have any idea about that topic, you can send a message to me and we can improve this idea together.
Trend Scalper (Expo)Trend Scalper (Expo)
DESCRIPTION
Trend Scalper (Expo) is a Scalping strategy based on RSI, Stochastic and moving averages techniques. The idea is to visualize scalping opportunities in trends.
The trend is determined by the color of the moving average called ‘TrendHolder’ The ‘Trendholer’ consists of 3 colors, green, red and orange. Green is a positive trend, red is a negative trend and orange is a neutral or no trend.
Scalping opportunities are visualized by the circles and the triangles. The circles are based on RSI calculation. The triangles are based on Stochastic calculation.
- If there is a green circle and a green triangle and ‘Trendholder’ is orange or green, Enter Long!
- If there is a red circle and a red triangle and ‘Trendholder’ is orange or red, Enter Short!
Combine the indicator with HEIKIN ASHI candlesticks.
HOW TO USE
1. Use the indicator to find scalping opportunities in trends.
I NDICATOR IN ACTION
BTCUSD
EURUSD
GOLD
The indicator works with RENKO, HEIKIN ASHI and with KAGI charts as well.
I hope you find this indicator useful, and please comment or contact me if you like the script or have any questions/suggestions for future improvements. Thanks!
I will continue to work on this indicator, so please share your experience and feedback with me so that I can continuously improve it. Thanks to everyone that have contacted me regarding my scripts. Y our feedback is valuable for future developments!
ACCESS THE INDICATOR
• Contact me on TradingView or use the links below
-----------------
Disclaimer
Copyright by Zeiierman.
The information contained in my scripts/indicators/ideas does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, or individual’s trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My scripts/indicators/ideas are only for educational purposes!
Trend Follower | jhThis is a trend following system that combines 3 indicators which provide different functionalities, also a concept conceived by VP's No Nonsense FX / NNFX method.
1. Baseline
The main baseline filter is an indicator called Modular Filter created by Alex Grover
- www.tradingview.com
- Alex Grover - Modular Filter
-------
That's the moving average like baseline following price, filtering long and short trends and providing entry signals when the price crosses the baseline.
Entry signal indicated with arrows.
2. Volume/Volatility, I will called it Trend Strength
The next indicator is commonly known as ASH, Absolute Strength Histogram.
This indicator was shared by VP as a two line cross trend confirmation indicator, however I discovered an interesting property when I modified the calculation of the histogram.
- Alex Grover Absolute Strength
-------
My modification and other info here
- Absolute Strength Histogram v2
-------
I simplified the display of the trend strength by plotting squares at the bottom of the chart.
- Lighted Squares shows strength
- Dimmed Squares shows weakness
3. Second Confirmation / Exits / Trailing Stop
Finally the last indicator is my usage of QQE (Qualitative Quantitative Estimation), demonstrated in my QQE Trailing Line Indicator
- QQE Trailing Line for Trailing Stop
-------
Three usages of this amazing indicator, serving as :
- Second trend confirmation
- Exit signal when price crosses the trailing line
- Trailing stop when you scaled out the second trade
This indicator is plotted with crosses.
Additional plots and information
Bar Color
- Green for longs, Red for shorts, White when the baseline direction conflicts with the QQE trailing line direction
- When it's white, it's usually ranging and not trending, ASH will also keep you off ranging periods.
-------
ATR Filter
- White circles along the baseline, they will show up if the price has moved more than one ATR from the baseline
- The default allowance is 1 ATR.
-------
The previous and current ATR value
- Label on the right side of the chart showing the previous and current value of ATR
Adding my Didi and ASH indicators up on this screenshot
Didi Index Improved with QQE
[HT] Hiubris TrendlinesHOW IT WORKS
This script automatically draws the last 2 TrendLines based on pivot points on the chart (wick to wick)
- Users can adjust the lookback length of those pivot points
NOTES
This Script is meant to help traders easily identify Trends and Trendlines
* This indicator does NOT Repaint! None of our published indicators repaint!
Trend Mode Indicator by Kripto MuhtarEn: This indicator is a combination of both linear regression slope and relative strength index. Linear regression slope is calculated, maximum and minimum values of a certain period is determined and a band for slope movement is declared. This bands is a similar of Bollinger Bands. While the slope is refered as speed, the speed of the trend mode is calculated by the movement in the bands. If slope crosses the mid band and sRSI is above 55(50 +filter value), it is accepted that the trend is in rising mode and vice versa. The RSI filter is optional. Blue area is rising trend mode, red area is falling trend mode, silver area is ranging trend mode.
The inputs:
Look back:Calculation period of linear regression slope
Smoothing: Weighted moving average period of the slope
Filter Value: The constant to add/subtract from smoothed RSI on signal line 50.
SRSI Period: Smoothed RSI period
Tr: Bu indikatör, lineer regresyon eğimi ve göreceli güç endeksi indikatörlerinin birleştirilmesi sonucu elde edilmiştir. Öncelikle lineer regresyon eğimi hesaplanmış, belirli bir periyotta maksimum ve minimum değerleri hesaplanmış ve bu sonuçlara göre Bollinger Bantlarına benzeyen bir bant elde edilmiştir. Hız, eğim ile ifade edildiğinden trendin hareket hızı da bant içindeki eğimin hareketine göre belirlenerek trend modu tespit edilmiştir. Eğer eğim çizgisi orta bandı yukarı keser ve sRSI 55(50+filter value) üzerinde ise bu koşul yükselen bir trendi göstermektedir ya da tersi. RSI filtresi opsiyoneldir. Mavi bölge yükselen trend modunu, kırmızı bölge düşen trend modunu, gümüş bölge yatay trend modunu göstermektedir.
Girdiler:
Look back: Lineer regresyon eğiminin hesaplama perioyodu
Smoothing: Eğimin ağırlıklı ortalama periyodu
Filter Value: RSI sinyal çizgisi 50 değerine eklenip çıkartılacak değer
SRSI Period: Yumuşatılmış RSI hesaplama periyodu
Trendtrader with profit/rentry==Strategy==
Adjust trend code until the majority of the up-trends are green and the downtrends are red. Take 20% profits at the first and second take profit levels while leaving the rest of the trade in until close.
==Indicator includes==
EMA cross, trend analysis, stoc-RSI TP and re-entries.
==Credits==
Trade Indicators for the strategy, jhanson107, for the trend indicator, and Zekis for helping with the TP and re-entries.
BOSS EMA Trend Meter PRO With Alerts BOSS PRO TRADING SYSTEM INDICATORS
Bullish Uptrend
To determine bullish uptrend there must beat least 2 green squares on all three trend meters. This is a great predictor that a uptrend is imminent. You can set alerts for top two meters being green as well as all 3 meters being green
Bearish Downtrend
To determine bearish downtrend there must beat least 2 red squares on all three trend meters. This is a great predictor that a downtrend is imminent. You can set alerts for top two meters being red as well as all 3 meters being red.
Purchase Here: bosscripts.com
HMA-Kahlman Trend & TrendlinesThis script utilizes two modules, Trendlines module (by Joris Duyck) and HMA-Kahlman Trend module. Trendlines module produces crossovers predictive of the next local trend.
(TBO) Trending Break OutTBO (Trending Break Out) is an indicator designed to help identify trends within the markets. Users are able to see trend continuations and potential trend reversals. Potential breakouts are also shown as trend strength increases or decreases. There are buy signals and short signals included as well. Clouds show underlying support or resistance areas and potential changes in trend strength. Pivots show resistance and support as well.
-Brought to you by Drungle_OG and MooninPapa (YouTubes)
Bitcoin long term trendsThis script shows the long term trends in Bitcoin price.
It is based on my mathematical formula for the long term trends.
The blue line is a long term trend as a power function B = (t/693)^5.526
And the green line is a more sophisticated trend, which models the wave behavior over the whole history of bitcoin.
This script is only applicable to BTCUSD price. The trend lines are calculated as the functions of time only.
BITFINEX:BTCUSD
Oasis Trend StrategyThis is a simple script developed to give a quick visual of trend on any given time frame.
This is a script that gives signals of trend switches. Can be used to for buying and selling signals.
On larger time Frames we use the Aqua and Fuchsia Clouds to express the larger time frame trends.
This can be used for long term swing trades especially useful with the 4hr, 6 hr, and daily chart to cancel out all the noise within the larger trends. The smaller Blue/Red Clouds can be used within trend if you are a skillful trader.
On smaller time frames (Intraday), we used the Blue and Red intraday price action. Is meant to be used
alongside with the Aqua/Fuchsia to create short term trades decisions within the short term trends indicated by the Aqua and Fuchsia.
The 9 ema is used to keep a close eye on short term directional changes.
You would want to see if price stays above or below this level along with its price action.
This should give you initial signs of strength or weakness.
The 55 ema (Black) is used to determine larger trend directional changes and for confirmation of trend shifts.
If interested, you can learn a lot just by watching the price react to these levels and can really visualize the price action that encompasses these averages.
We recommend that all traders study Technical patterns, Price action, Financial risk management, and other pre-trade planning strategies to minimize drawdown risk.
Please give us a like and a follow if you like this indicator. Its simple and very easy to use.
We are not financial advisors. We do not give financial advise. Please use this indicator at your free will.
We are not responsible for any financial losses or claims.
If you find this indicator very useful as I have, we do appreciate any amount of tips.
This will fund us to create more indicators to be made for your use.
BTC - 3PmVmmsnuLedg7umzVkLnarKRo43g6P5Tp
ETH - 0x9a1Ba8809687D8d9A1D32Ed1602abEef48060aF1
LTC - MAgqbC6Kev1x3L2GvNwzhZacyBRxCKJ8Mi
ZCash - t1UYRLzQxeaHCNYfA9cLChfBX5mbcNqworA
0x - 0x2B07D8BFB20b6eDb9A498113764082211cdFA2cE
Many free Tradingview users can benefit from our indicators as we employ many many useful indicators that can be toggled in each script to surpass the indicator limits.
Popat Trend AlanyzerThis tool will help you analyze the trend where you determine when you have to enter and when exits with your Technical analysis, with this indicator you can easily spot if market is trending or ranging and can trade according to it. You can use it with any time frame, you can use it bigger time frames for accurate result coz there are lot of noise in smaller time frame, this is not a 100% working system but you can make money in trending market buy with proper risk management and discipline.
I have include multiple indicator in the one , The main benefit of this all in one indicator is that you can use all of the indicator one by one by turning of all other in one click so your chart looks clean and you can see the candles. And if you have FREE plan in Trading view where you can use only 3 indicators but with this you can use more than 3 in single chart, included indicator are Moving averages and ichimoku kinko hyo.
USE OF INDICATORS
1)7/30 Moving averages
This is default indicator with 7/30 MA and background ploting (you can remove background color) when you add POPAT TREND ANALYZER
2) 50/200 cross trend arrows at top n bottom
If you enable this check you will see black and red circles on the top and bottom of your chart, where BLACK CIRCLE at bottom indicate bullish crossover between 50/200 in pertucaler time frames and RED CIRCLE at the top indicate bearish 50/200 crossover, and you can on off it by one click, with this you can easily see the current trend or crossover of 50/200 MA without add both MAs.
3) Ichimoku T & K On/Off
Enable this if you want to add only Tenkan and kijun, many TA experts only use T&K crossover to determine their next trade. For more information about ichimoku you can search on the internet.
4) Ichimoku Cloud On/Off
If you enable this you can add only kumo cloud which is combination of senkou A & senkou B and ploting it in the future. Many people want to use kumo cloud without Tenkan and kijun and want to use the favorites Moving averages with it, they will defiantly love it.
4) SMA 50/100/200 On/Off
Here I have added 3 big Moving averages which is 50,100 and 200, in the FREE plan of trading view you can only 3 indicators and you have to remove one for add another one but now you can easily add it by single check to see the big trend quickly and hide it easily.
If you have any question or suggestions you can comment below.
Happy Trading.
Power Trend by Atilla YurtsevenPower Trend is the indicator that i have developed for myself and would like to share with you.
Power Trend automatically detects High / Low points and draw trend lines. If you have a look at the graph, you can simply draw a line over last 2 points to combine them and see the trends current state. You can also change High and Low points' sources. I often use Horizontal trend lines by selecting "close" for both High and Low sources.
I also love to use Horizontal Trends. They usually shows breakouts. Expect a breakout when lines are close to each other.
Remember; this is a lagging indicator. If there is a point in the current bar, indicator will draw it after 2 bars!
Disclaimer: All the information in this article, including the algorithm/indicator, was provided and published for informational purposes only and should not be considered legal or financial advice.
Happy trading :)
Atilla Yurtseven
[NMM] TrendLines - v1An easy to use chart to display trend lines for the current trends in effect.
There are simply two parameters:
- Base Period: Defines how long back you are looking for trends. For a given base period of X, price from upto 5X bars back is taken into consideration for drawing trend lines. I would suggest keeping this to a low value. Default is 12.
- Smoothing Period: To further smoothen the trend lines, use this parameter.
Usually, a trend reversal can be easily seen from this indicator. At reversals, there is a clearly visible reversal of this indicator. If you look carefully, you can even count Eliott Waves easily on this indicator, which are sharply defined.
NOTE: I am available for custom work on hire. Contact me via PM, if required.
Spicytrader V4 [LONG and SHORT signals + Trendline]NEW VERSION : JUNE 2018
LONG and SHORT signals (with alerts)
Trendline : Bullish and bearish market (with alerts)
Compatible with Autoview bot (Open Long/Short)
Working with 1min* interval and more (1min to Month)
TRY IT FOR FREE : spicytrader.com
* Market has to be enough volatile to use it with 1min interval (Ok with ETHER for instance).
Use these scripts together to maximize profit
Spicytrader V4
Squeeze Momentum Indicator
Pivot Point High Low
How to use the script
Add the scripts to your chart
Select a time interval from 1min to 1 month which shows great trends (Multiple following colored candles)
Don't go if trends are not well defined
LONG position
The BLUE* candle is CLOSED and BULLISH (Green candle)
Squeeze Momentum Indicator is BULLISH
Trendline is BULLISH (Green)
Candle close above Trendline
Pivot Points are below or far enough
Don't go if trends are not well defined
* Dark blue is a strong buy signal
* Ligh blue is a weak buy signal but can be ok depending of the market
SHORT position
The YELLOW candle is CLOSED and BEARISH (Red candle)
Squeeze Momentum Indicator is BEARISH
Trendline is BEARISH (Red)
Candle close bellow Trendline
Pivot Points are above or far enough
Don't go if trends are not well defined
When to close a trade ?
Trend is over (New closed candle is NOT colored)
or Market direction is changing
or Pivot Point is reached and failed to cross
or You feel it
WARNING :
The purpose of these signals is to HELP/SUPPORT you to take a decision.
You need to analyse the general trend before placing an order.
Don't trust FOMO or FUD and do your own research
TRY IT FOR FREE : spicytrader.com
TRY IT FOR FREE : spicytrader.com
TRY IT FOR FREE : spicytrader.com
How to use it with Autoview
Add an alert (OPEN LONG or OPEN SHORT) and set it to "Once Per bar Closed" in order to place an order after the confirmation.
Refer to the official website (Autoview) bit.ly to get more information.
Trend Detector IndicatorTrend Detector Indicator
Class : trend oscillator/average analysis
Trading type : trading in trend
Time frame : 1 day
Purpose : trend detection
Level of aggressiveness : conservative
The key problem of trend following trading is danger of entering into position at extreme points of the trend with further trend reverse. Plus in any case it is very important to understand the phase of the trend cycle to be effective and successful trader.
Each trend can be divided into several phases: start of the trend, active development, consolidation phase, end of the trend. Obviously the most interesting phases for trading in trend are start and active development of the trend. At these phases risk of unsuccessful trading in trend direction is minimal, but profit opportunities are maximal. Still as a rule it is quite hard to detect the start of the trend. As the result probability of false signals is rather high.
Indicator «Trend Detector Indicator» is developed to identify the active phases of the trend cycle and helps to avoid trading at the end of the trend.
Using unique algorithm Indicator “TDI” allows to identify moments in price dynamics which are the most appropriate for trading in trend.
Structure of the indicator
Indicator consists of the TDI line and special colored zones:
- TDI line (multi-colored line in the indicator window) – is used to divide phases of the trend cycle, different colors signal about current type of price dynamics (blue color – uptrend, red color – downtrend, green – flat);
- Colored zones (blue, yellow and red colors depending on type of the signal) – are used for color indication of the trend cycle phases. Blue color means that trend is in active phase. Yellow warns about possible transition of the trend to the extinction. Entering the red zone is a signal of possible break of a trend.
Input parameters of the indicator
To set up the indicator a number of input parameters are used:
- Average period – averaging period. Responsible for the data filtration (by default = 13). The bigger the period is the less quantity of the signals would be, but the higher their quality is expected. Decrease of this parameter allows to increase the aggressiveness of the trading and the number of generated signals, but potentially this can decrease the quality of the signals
- Correlation period – period which is used in correlation analysis to calculate the correlation moment (by default = 21).
Rules of trading
Entering of the TDI line into blue zone and being there is a signal for active trading in current price direction. The direction of the tendency is indicated by the color of the TDI line: blue color – uptrend and “buy” signal, red color – downtrend and “sell” signal, green – flat, that means there is no dominating tendency and trading in trend should be postponed.
Since the basis for the trades are trend signals, their closing with profits or stops should be done when these signals lost relevance. So stop-loss and take-profit parameters are not provided. Such approach allows to avoid profit limitation by a certain number of points and to extract maximum from the active phase of the trend cycle, which is not limited in theory.
Change of the TDI line color in blue zone is a signal to close current long positions. Exit of the TDI line from blue zone is a signal to close current trend positions.
Script and Bot Marketplace's Trend Detector 2.0Use this custom indicator to analyze the current trend of any market that you choose on all time frames. Works great as a secondary indicator while day or swing trading.
Interested? Check us out here: www.scriptandbotmarketplace.com
Join our discord to talk about bots, scripts, and crypto: discord.gg
Auto Bull/Bear TrendlinesAutomated trendlines for easily identifying market trend continuation or reversals
DOZ Trend Precision – ADX & EMA Confluence Pro | v2.0📈 DOZ Trend Precision – ADX & EMA Confluence Pro | v2.0
🔍 Smart Trend Detection with Institutional Accuracy
🧠 About This Indicator:
The DOZ Trend Precision v2.0 is built for traders who demand real confluence between trend direction and market strength, using two powerful tools: the ADX (Average Directional Index) and EMAs (Exponential Moving Averages).
This upgraded version only triggers buy/sell signals when an EMA crossover occurs after the ADX confirms trend strength, filtering out weak trades and noisy price action.
Perfect for identifying high-conviction entries with clarity.
⚙️ How It Works:
✅ ADX Trend Strength Filter:
• The ADX must be above 20 to confirm a trending market and avoid signals during sideways price movement.
✅ EMA Cross Confluence:
• The fast EMA must cross the slow EMA only after the ADX confirms sufficient strength.
✅ Directional Confirmation with DI+/DI-:
• For a BUY, DI+ must be greater than DI-
• For a SELL, DI- must be greater than DI+
🔔 Visual Signals & Alerts:
📍 BUY Signal:
• Triggered when the fast EMA crosses above the slow EMA
• ADX is above 20
• DI+ > DI-
📍 SELL Signal:
• Triggered when the fast EMA crosses below the slow EMA
• ADX is above 20
• DI- > DI+
✅ Built-in alert conditions for full automation or TradingView notifications.
✅ Clear on-chart labels for fast visual recognition.
💡 Best For:
Swing traders & day traders focused on trend continuation
Avoiding false signals in ranging markets
Strategies that prioritize strong trend confirmation
Alert-based systems or automation
bots
Trend Factor Simplified - Shared (Crypto)A Trend Following Indicator for crypto, stronger than your thought, entering lower region means you need to be careful of buying/long chance, entering upper region means you need to be careful of selling/short chance, good luck! NOT an oscillator/reversal indicator, don't be mislead by its plotting way.
一个加密货币的趋势跟踪指标,比你想的要强的那种,进入下方区域说明要关注买入/做多机会,进入上方区域说明要关注卖出/做空机会,实际操作试试看就知道了。不是振荡器/反转指标,别用错了。
Machine Learning | Adaptive Trend Signals [Bitwardex]⚙️🧠Machine Learning | Adaptive Trend Signals
🔷Overview
Machine Learning | Adaptive Trend Signals is a Pine Script™ v6 indicator designed to visualize market trends and generate signals through a combination of volatility clustering, Gaussian smoothing, and adaptive trend calculations. Built as an overlay indicator, it integrates advanced techniques inspired by machine learning concepts, such as K-Means clustering, to adapt to changing market conditions. The script is highly customizable, includes a backtesting module, and supports alert conditions, making it suitable for traders exploring trend-based strategies and developers studying volatility-driven indicator design.
🔷Functionality
The indicator performs the following core functions:
• Volatility Clustering: Uses K-Means clustering to categorize market volatility into high, medium, and low states, adjusting trend sensitivity accordingly.
• Trend Calculation: Computes adaptive trend lines (SmartTrend) based on volatility-adjusted standard deviation, smoothed RSI, and ADX filters.
• Signal Generation: Identifies potential buy and sell points through trend line crossovers and directional confirmation.
• Backtesting Module: Tracks trade outcomes based on the SmartTrend3 value, displaying win rate and total trades.
• Visualization: Plots trend lines with gradient colors and optional signal markers (bullish 🐮 and bearish 🐻).
• Alerts: Provides configurable alerts for trend shifts and volatility state changes.
🔷Technical Methodology
Volatility Clustering with K-Means
The indicator employs a K-Means clustering algorithm to classify market volatility, measured via the Average True Range (ATR), into three distinct clusters:
• Data Collection: Gathers ATR values over a user-defined training period (default: 100 bars).
• Centroid Initialization: Sets initial centroids at the highest, lowest, and midpoint ATR values within the training period.
• Iterative Clustering: Assigns ATR data points to the nearest centroid, recalculates centroid means, and repeats until convergence.
• Dynamic Adjustment: Assigns a volatility state (high, medium, or low) based on the closest centroid, adjusting the trend factor (e.g., tighter for high volatility, wider for low volatility).
This approach allows the indicator to adapt its sensitivity to varying market conditions, providing a data-driven foundation for trend calculations.
🔷Gaussian Smoothing
To enhance signal clarity and reduce noise, the indicator applies Gaussian kernel smoothing to:
• RSI: Smooths the Relative Strength Index (calculated from OHLC4) to filter short-term fluctuations.
• SmartTrend: Smooths the primary trend line for a more stable output.
The Gaussian kernel uses a sigma value derived from the user-defined smoothing length, ensuring mathematically consistent noise reduction.
🔷SmartTrend Calculation
The pineSmartTrend function is the core of the indicator, producing three trend lines:
• SmartTrend: The primary trend line, calculated using a volatility-adjusted standard deviation, smoothed RSI, and ADX conditions.
• SmartTrend2: A secondary trend line with a wider factor (base factor * 1.382) for signal confirmation.
SmartTrend3: The average of SmartTrend and SmartTrend2, used for plotting and backtesting.
Key components of the calculation include:
• Dynamic Standard Deviation: Scales based on ATR relative to its 50-period smoothed average, with multipliers (1.0 to 1.4) applied according to volatility thresholds.
• RSI and ADX Filters: Requires RSI > 50 for bullish trends or < 50 for bearish trends, alongside ADX > 15 and rising to confirm trend strength.
Volatility-Adjusted Bands: Constructs upper and lower bands around price action, adjusted by the volatility cluster’s dynamic factor.
🔷Signal Generation
The generate_signals function generates signals as follows:
• Buy Signal: Triggered when SmartTrend crosses above SmartTrend2 and the price is above SmartTrend, with directional confirmation.
• Sell Signal: Triggered when SmartTrend crosses below SmartTrend2 and the price is below SmartTrend, with directional confirmation.
Directional Logic: Tracks trend direction to filter out conflicting signals, ensuring alignment with the broader market context.
Signals are visualized as small circles with bullish (🐮) or bearish (🐻) emojis, with an option to toggle visibility.
🔷Backtesting
The get_backtest function evaluates signal outcomes using the SmartTrend3 value (rather than closing prices) to align with the trend-based methodology.
It tracks:
• Total Trades: Counts completed long and short trades.
• Win Rate: Calculates the percentage of trades where SmartTrend3 moves favorably (higher for longs, lower for shorts).
Position Management: Closes opposite positions before opening new ones, simulating a single-position trading system.
Results are displayed in a table at the top-right of the chart, showing win rate and total trades. Note that backtest results reflect the indicator’s internal logic and should not be interpreted as predictive of real-world performance.
🔷Visualization and Alerts
• Trend Lines: SmartTrend3 is plotted with gradient colors reflecting trend direction and volatility cluster, accompanied by a secondary line for visual clarity.
• Signal Markers: Optional buy/sell signals are plotted as small circles with customizable colors.
• Alerts: Supports alerts for:
• Bullish and bearish trend shifts (confirmed on bar close).
Transitions to high, medium, or low volatility states.
🔷Input Parameters
• ATR Length (default: 14): Period for ATR calculation, used in volatility clustering.
• Period (default: 21): Common period for RSI, ADX, and standard deviation calculations.
• Base SmartTrend Factor (default: 2.0): Base multiplier for volatility-adjusted bands.
• SmartTrend Smoothing Length (default: 10): Length for Gaussian smoothing of the trend line.
• Show Buy/Sell Signals? (default: true): Enables/disables signal markers.
• Bullish/Bearish Color: Customizable colors for trend lines and signals.
🔷Usage Instructions
• Apply to Chart: Add the indicator to any TradingView chart.
• Configure Inputs: Adjust parameters to align with your trading style or market conditions (e.g., shorter ATR length for faster markets).
• Interpret Output:
• Trend Lines: Use SmartTrend3’s direction and color to gauge market bias.
• Signals: Monitor bullish (🐮) and bearish (🐻) markers for potential entry/exit points.
• Backtest Table: Review win rate and total trades to understand the indicator’s behavior in historical data.
• Set Alerts: Configure alerts for trend shifts or volatility changes to support manual or automated trading workflows.
• Combine with Analysis: Use the indicator alongside other tools or market context, as it is designed to complement, not replace, comprehensive analysis.
🔷Technical Notes
• Data Requirements: Requires at least 100 bars for accurate volatility clustering. Ensure sufficient historical data is loaded.
• Market Suitability: The indicator is designed for trend detection and may perform differently in ranging or volatile markets due to its reliance on RSI and ADX filters.
• Backtesting Scope: The backtest module uses SmartTrend3 values, which may differ from price-based outcomes. Results are for informational purposes only.
• Computational Intensity: The K-Means clustering and Gaussian smoothing may increase processing time on lower timeframes or with large datasets.
🔷For Developers
The script is modular, well-commented, encouraging reuse and modification with proper attribution.
Key functions include:
• gaussianSmooth: Applies Gaussian kernel smoothing to any data series.
• pineSmartTrend: Computes adaptive trend lines with volatility and momentum filters.
• getDynamicFactor: Adjusts trend sensitivity based on volatility clusters.
• get_backtest: Evaluates signal performance using SmartTrend3.
Developers can extend these functions for custom indicators or strategies, leveraging the volatility clustering and smoothing methodologies. The K-Means implementation is particularly useful for adaptive volatility analysis.
🔷Limitations
• The indicator is not predictive and should be used as part of a broader trading strategy.
• Performance varies by market, timeframe, and parameter settings, requiring user experimentation.
• Backtest results are based on historical data and internal logic, not real-world trading conditions.
• Volatility clustering assumes sufficient historical data; incomplete data may affect accuracy.
🔷Acknowledgments
Developed by Bitwardex, inspired by machine learning concepts and adaptive trading methodologies. Community feedback is welcome via TradingView’s platform.
🔷 Risk Disclaimer
Trading involves significant risks, and most traders may incur losses. Bitwardex AI Algo is provided for informational and educational purposes only and does not constitute financial advice or a recommendation to buy or sell any financial instrument . The signals, metrics, and features are tools for analysis and do not guarantee profits or specific outcomes. Past performance is not indicative of future results. Always conduct your own due diligence and consult a financial advisor before making trading decisions.