Momentum Aggregator to identify Pivot PointsThis indicator takes into account various indicators like RSI, MACD etc.. to identify confluence and divergence which will help to identify pivot points in price.
Legend:
Green candles identify when there is a confluence of momentum to the upside
Red candle identify when there is a confluence of momentum to the downside
Note: These colors do not identify a positive or negative change in price for the candle. The candle outline identifies this
White candles identify when there is a divergence in momentum often identifying a pivot point for price
Yellow candles identify extreme exhaustion often indicating a good time to anticipate a reversal
Forecasting
Daily Open LineIndicator Goal/Objective:
This is a Simple Code to show Daily Open Level in chart
This script plots a circle at the open price of the current day on the chart.
It marks the first bar's open price of each new trading day and
keeps the same value for the rest of the day until a new trading day begins.
It is only for analysis purpose only.
it is not a new indicator and can be replica of any other persons indicator.
The purpose of making indicator as an individual indicator is only for easiness.
Price Projection by Linear RegressionPurpose:
This is a TradingView Pine Script indicator that performs a linear regression on historical price data to project potential future price levels. It's designed to help traders visualize long-term price trends and potential future price targets.
Key Components:
User Inputs:
Historical Data Points (default 1000 bars) - The amount of historical data used to calculate the trend
Years to Project (default 10 years) - How far into the future to project the price
Technical Implementation:
Uses linear regression (ta.linreg) to calculate the trend slope
Converts years to trading days using 252 trading days per year
Limits visible projection to 500 bars due to TradingView's drawing limitations
Projects prices using the formula: current_price + (slope × number_of_bars)
Visual Elements:
Blue line showing actual historical prices
Red projection line showing the expected price path
Label showing the projected price at the visible end of the line
Information table in the top-right corner showing:
Current price
Final projected price after the full time period
Limitations:
Can only display projections up to 500 bars into the future (about 2 years) due to TradingView limitations
The full projection value is still calculated and shown in the table
Past performance doesn't guarantee future results - this is a mathematical projection based on historical trends
Usage:
Traders can use this to:
Visualize potential long-term price trends
Set long-term price targets
Understand the historical trend's trajectory
Compare current prices with projected future values
Fvs-indicatorEle usa 3 médias para acompanhamento, um canal com Upper e Lower e uma média que cruza as linhas definindo compra e venda
kyle trend v1(Tony Bii?)Kyle Trend v1 is a powerful multi-functional trading indicator designed to assist traders in identifying trends, reversals, and optimal entry/exit points. It combines the precision of a modified Supertrend strategy with the flexibility of custom Keltner Channels and dynamic EMA layers, making it suitable for traders of all styles.
MACD DETTAEste indicador é uma versão personalizada do clássico MACD (Moving Average Convergence Divergence), projetado para se ajustar automaticamente às configurações ideais de médias móveis exponenciais (EMAs) e da linha de sinal com base no timeframe do gráfico. Ele combina flexibilidade e automação para simplificar a análise técnica, adaptando-se automaticamente às condições específicas de diferentes períodos.
Indicators Table[Robinson0707]
I try to make a table for simple indicator. I hope you lile it. For now I just add classic, fibonacci and wodie pivont point. And ı use Exponanctal moving avera. If you want you can open it as a plot. Also I ad Benjamin GRAHAM's valuation formula
Moving Average Convergence DivergenceTake your trading to the next level with this enhanced Moving Average Convergence Divergence (MACD) indicator. Featuring clear visual signals for "Buy" and "Sell" points, this MACD is designed to simplify your decision-making process. Pair it with our Dynamic SMA Pro Chart for trend confirmation and our Stochastic Indicator for momentum analysis to get a well-rounded view of market trends. Whether you're a beginner or a seasoned trader, this tool helps you spot key opportunities with confidence. Perfect for identifying reversals and optimizing your entries and exits!
Quasimodo PatternWhat is a Quasimodo Pattern?
A Quasimodo Pattern is a chart pattern traders look for to predict possible price reversals in the market:
- Bullish Quasimodo: Signals a possible price increase (buying opportunity).
- Bearish Quasimodo: Signals a potential price decrease (selling opportunity).
How the Script Works
1. Bullish Quasimodo:
- Checks if the price pattern shows signs of a potential upward movement:
- The current low price is higher than a previous price point (suggesting fair value gap).
- The previous candle closed higher than it opened (bullish candle).
- The candle before that closed lower than it opened (bearish candle).
2. Bearish Quasimodo:
- Looks for signs of a downward movement:
- The current high price is lower than a previous price point (suggesting fair value gap).
- The previous candle closed lower than it opened (bearish candle).
- The candle before that closed higher than it opened (bullish candle).
Visual Indicators
- Yellow Candles: Indicate a bullish Quasimodo pattern.
- Pink Candles: Indicate a bearish Quasimodo pattern.
Alerts
If a Quasimodo pattern is detected, the script sends an alert:
- The alert says: "A Quasimodo Pattern has appeared!"
Purpose
Traders can use this tool to quickly spot potential trend changes without manually analyzing every chart, saving time and improving decision-making for trades.
buy sel StrategyGöstergenin Amacı
Bu gösterge:
Alım ve satım sinyalleri üretmek için MACD ve Bollinger Bantları kombinasyonunu kullanır.
Sinyalleri grafik üzerinde göstermek için oklar (yukarı ve aşağı) çizer.
Önemli sinyal durumlarında kullanıcıyı uyarmak için uyarı mekanizması içerir.
2. Kullanılan Teknik Göstergeler
A) MACD (Moving Average Convergence Divergence)
MACD, iki üstel hareketli ortalama arasındaki farkı ölçer:
Hızlı MACD Periyodu: Kısa dönem EMA (varsayılan: 12).
Yavaş MACD Periyodu: Uzun dönem EMA (varsayılan: 26).
Sinyal MACD Periyodu: MACD hattının yumuşatılmış versiyonu (varsayılan: 9).
Koşullar:
Alım Sinyali: MACD hattı, sinyal hattını yukarı yönde keser (ta.crossover fonksiyonu).
Satım Sinyali: MACD hattı, sinyal hattını aşağı yönde keser (ta.crossunder fonksiyonu).
B) Bollinger Bantları
Bollinger Bantları, fiyatın oynaklığını (volatilite) ölçmek için kullanılır:
Orta Bant: Fiyatın hareketli ortalamasıdır (varsayılan: 20 periyotluk SMA).
Üst Bant: Orta banda, standart sapmanın belirli bir katı eklenir (varsayılan: 2.0).
Alt Bant: Orta bandan, standart sapmanın belirli bir katı çıkarılır (varsayılan: 2.0).
3. Göstergenin İşlevselliği
A) Alım Koşulu (buy_condition):
pinescript
Kopyala
Düzenle
buy_condition = ta.crossover(macd_line, signal_line) and close > bb_lower
Al sinyali, şu iki şart sağlandığında tetiklenir:
MACD hattı, sinyal hattını yukarı yönde keserse (pozitif momentum).
Fiyat, Bollinger Bantları'nın alt bandının üzerine çıkarsa (fiyatın potansiyel dipten yukarı dönüşü).
B) Satım Koşulu (sell_condition):
pinescript
Kopyala
Düzenle
sell_condition = ta.crossunder(macd_line, signal_line) and close < bb_upper
Sat sinyali, şu iki şart sağlandığında tetiklenir:
MACD hattı, sinyal hattını aşağı yönde keserse (negatif momentum).
Fiyat, Bollinger Bantları'nın üst bandının altına düşerse (fiyatın potansiyel zirveden dönüşü).
4. Grafik Üzerindeki Gösterim
A) Bollinger Bantları:
Üst Bant (kırmızı çizgi).
Alt Bant (yeşil çizgi).
Orta Bant (turuncu çizgi).
B) Alım ve Satım Sinyalleri:
Oklar:
Yeşil ok (yukarı): Alım sinyali.
Kırmızı ok (aşağı): Satım sinyali.
C) Plotlama:
plotarrow fonksiyonu, yukarı ve aşağı sinyalleri oklarla grafik üzerinde gösterir:
pinescript
Kopyala
Düzenle
plotarrow(buy_condition ? 1 : sell_condition ? -1 : na, colorup=color.green, colordown=color.red, offset=-1)
5. Uyarılar
Uyarılar, sinyallerle kullanıcıyı bilgilendirir:
Alım Sinyali Uyarısı:
Mesaj: "MACD ve fiyat, Bollinger Bandı'nın alt sınırının üzerine çıktı."
Satım Sinyali Uyarısı:
Mesaj: "MACD ve fiyat, Bollinger Bandı'nın üst sınırının altına indi."
6. Kodun Avantajları
Kombinasyon Stratejisi: MACD ve Bollinger Bantları’nın birleşimi daha doğruluklu sinyaller üretebilir.
Basit ve Görsel: Grafik üzerinde sinyaller net bir şekilde belirtilmiştir.
Uyarı Mekanizması: Otomatik olarak işlem yapmak veya uyarı almak isteyen kullanıcılar için uygundur.
7. Dezavantajlar
Lag (Gecikme): Hem MACD hem de Bollinger Bantları gecikmeli göstergelerdir, bu da sinyalin gecikmesine neden olabilir.
Trend Filtreleme Eksikliği: Yanlış sinyalleri azaltmak için trend yönünü doğrulayan ek bir filtre (ör. EMA 200) faydalı olabilir.
8. Geliştirme Önerileri
Trend Filtresi: Yanlış sinyalleri azaltmak için EMA (200) gibi bir trend filtresi eklenebilir.
Fazla Sinyallerin Azaltılması: RSI gibi bir gösterge ile daha fazla doğrulama katmanı eklenebilir.
Zaman Aralığı Testi: Bu strateji en iyi 15 dakika, 1 saat veya 1 günlük zaman aralıklarında test edilerek optimize edilebilir.
Bu kod, daha sofistike stratejiler oluşturmak için güçlü bir başlangıç noktasıdır. Doğru parametre ayarlarıyla etkili bir ticaret aracı haline gelebilir.
TrendFusion ReversalUma combinação de lógica de rastreamento de tendências e detecção de topos/fundos para identificar sinais de possível reversão no mercado. Abrange gerenciamento de alvos, stop loss e alertas de pontos críticos, auxiliando na análise técnica e na tomada de decisões de entrada e saída de trades
ETI IndicatorThe Ensemble Technical Indicator (ETI) seeks to combine numerous technical indicators into a single figure that reflects whether a stock is bullish or bearish. Specifically the ETI consists of the following indicators:
SMA 10
WMA 10
RSI
Stochastic Oscillator K%
Stochastic Oscillator D%
MACD
Williams R%
A/D Oscillator
Commodity Channel Index (CCI)
These indicators are converted to either -1 or +1, depending on whether the indicator's value suggests a bullish trend, or bearish trend. These values are then added up and summed across 20 timeframes to derive a single figure.
It is suggested that stocks -40 and below are oversold, while those that are +50 and above are overbought.
Year-over-Year % Change for PCEPILFEHello, traders!
This indicator is specifically for FRED:PCEPILFE , which is a 'Personal Consumption Expenditures (PCE) Index excluding food and energy.'
What this indicator does is compare the monthly data to that of the same month last year to see how it has changed over the year. This comparison method is widely known as YoY(Year-over-Year).
While I made this indicator to use for FRED:PCEPILFE , you may use it for different charts as long as they show monthly data.
FRED:PCEPILFE is one of the main measures of inflation the Federal Reserve uses.
You can see the YoY % change of the PCE Index excluding food and energy in the official website for the Bureau of Labor Statistics, but unfortunately, I couldn't find one in TradingView.
So instead, I decided to make my own indicator showing the changes using FRED:PCEPILFE .
The code is very simple: it compares the data to the data 12 points ago because 12 points would mean 12 months in this chart. We then multiply the result by 100 for percentage.
Doing so, we compare the current month to the same month of the previous year.
Because I am only interested in the YoY % Change of the index, I pulled the indicator all the way up, covering the original chart data entirely. (Or you could achieve the same by simply moving your indicator to the pane above. But this way, the original chart data is also visible.)
I hope this indicator helps you with your analysis. Feel free to ask questions if have any!
God bless!
Maia Day Trade and Swing TradeGeneral Explanation:
While developing Maia, we wanted to reflect more than 30 indicators on a single screen in different time frames or different base settings.
There are two features you can use on your analysis:
Different Value Fixed Time (1 Hour Timeframe)
In this feature, you will see three lines on your graph which are Fast Legnth (period of 7) Base Legnth (period of 14) and Slow Legnth (period 21). Also you can change and period's which can be fit better to your strategy.
Fixed Value Different Time (1/5/15/30/60/240 Minute Timeframe)
In this features, you will see six lines on your graph, these lines calculates by Base Length or Base Calculation which can be change at setting screen.
Indicator List:
Parabolic SAR
Relative Strength Index ( RSI )
Commodity Channel Index ( CCI )
Money Flow Index ( MFI )
Rate of Change ( ROC )
Average True Range ( ATR )
Aroon
Arnaud Legoux Moving Average ( ALMA )
Bollinger Band Width ( BBW )
Coppock Curve
Chande Momentum Oscillator ( CMO )
Center of Gravity ( COG )
Positive Directional Movement ( +DI )
Negative Directional Movement ( -DI )
Average Directional Movement Index ( ADX )
Ease of Movement ( EOM )
Fractal Adaptive Moving Average ( FRAMA )
Hilbert Transform ( HT )
Hull Moving Average ( HMA )
Inverse Fisher Transform ( IFT )
Keltner Channels Width ( KCW )
Linear Regression Curve ( LINREG )
Momentum ( MOM )
Super Trend
Super Trend ( Signal )
Sentiment Zone Oscillator ( SZO )
Standard Deviation
True Strength Index ( TSI )
Ultimate Oscillator ( UO )
Volume Zone Oscillator ( VZO )
Wave Period Oscillator ( WPO )
Weighted Moving Average ( WMA )
Williams %R
Important Notice:
* Indicator, core data and decision function is designed based on Bitcoin futures market. Signals may not work properly for other equities.
Tips & Tricks:
* Don't forget, every positions has own risks and profits but trade in main trend is crucial.
ICT CRT Model Range with EquilibriumICT CRT Model Range with Equilibrium Indicator
This indicator calculates and displays the high, low, and equilibrium levels within a custom-defined session (9:00 am to 10:00 am New York Time and the lines will stop appearing at 16:00pm ). It draws horizontal lines to represent the session's range and marks the equilibrium point as a reference.
What is CRT (Candle Range Theory)?
Candle Range Theory (CRT) is based on the concept that every candle on any timeframe forms its own range. These ranges can either be manipulated—through strategies like Turtle Soup—or broken, resulting in price movements such as engulfing patterns, breakouts, and retests beyond the candle's high or low.
CRT is commonly visualized as a 3-candle model, but it can include more candles due to the presence of inside bars. An inside bar is a candle whose high is not higher than the previous candle's high and whose low is not lower than the previous candle's low.
The CRT model follows the A-M-D structure:
Accumulation (A): The first candle or group of candles (inside bars) represents market consolidation.
Manipulation (M): The second candle signals a false move, often a Turtle Soup setup designed to trap traders.
Distribution (D): The third candle confirms the true market move, breaking out of the range and establishing the trend.
Customizable Settings:
Line Colors: Choose your preferred colors for the high, low, and equilibrium lines.
Line Widths: Adjust the thickness of the lines for better visibility.
Line Styles: Select from solid, dotted, or dashed styles for each line.
Label Settings: Customize the text and colors of the labels for the high, low, and equilibrium points.
Traders can easily modify these settings to suit their visual preferences and trading strategies. This indicator is ideal for identifying price action within a specific range, offering clear visual cues for potential CRT Setup.
ALERTA - SALVADOR🚀 ALERTA - SALVADOR 🚀
Monitore seus ativos com precisão e agilidade! Este indicador poderoso utiliza o **cruzamento de médias móveis** no timeframe de 5 minutos para identificar oportunidades claras de COMPRA e VENDA.
REQUISITOS:
✔️ Alertas visuais diretamente no gráfico.
✔️ Alertas sonoros automáticos para não perder nenhuma oportunidade.
✔️ Cálculo instantâneo da porcentagem de lucro no momento da venda, exibido
diretamente no gráfico com um design limpo e objetivo.
👉 Ideal para traders que buscam decisões rápidas e bem fundamentadas!
AG Custom Weight Index(BETA)The Adani Group Custom Weight Index is a specialized financial indicator designed to track the market performance of the top seven publicly listed companies within the Adani Group. The index provides a comprehensive view of the group's market trends by equally weighting each company's contribution, ensuring no single stock dominates the index movement.
Lead-Lag Market Detector [CryptoSea]The Lead-Lag Market Detector is an advanced tool designed to help traders identify leading and lagging assets within a chosen market. This indicator leverages correlation analysis to rank assets based on their influence, making it ideal for traders seeking to optimise their portfolio or spot key market trends.
Key Features
Dynamic Asset Ranking: Utilises real-time correlation calculations to rank assets by their influence on the market, helping traders identify market leaders and laggers.
Customisable Parameters: Includes adjustable lookback periods and correlation thresholds to adapt the analysis to different market conditions and trading styles.
Comprehensive Asset Coverage: Supports up to 30 assets, offering broad market insights across cryptocurrencies, stocks, or other markets.
Gradient-Enhanced Table Display: Presents results in a colour-coded table, where assets are ranked dynamically with influence scores, aiding in quick visual analysis.
In the example below, the ranking highlights how assets tend to move in groups. For instance, BTCUSDT, ETHUSDT, BNBUSDT, SOLUSDT, and LTCUSDT are highly correlated and moving together as a group. Similarly, another group of correlated assets includes XRPUSDT, FILUSDT, APEUSDT, XTZUSDT, THETAUSDT, and CAKEUSDT. This grouping of assets provides valuable insights for traders to diversify or spread exposure.
If you believe one asset in a group is likely to perform well, you can spread your exposure into other correlated assets within the same group to capitalise on their collective movement. Additionally, assets like AVAXUSDT and ZECUSDT, which appear less correlated or uncorrelated with the rest, may offer opportunities to act as potential hedges in your trading strategy.
How it Works
Correlation-Based Scoring: Calculates pairwise correlations between assets over a user-defined lookback period, identifying assets with high influence scores as market leaders.
Customisable Thresholds: Allows traders to define a correlation threshold, ensuring the analysis focuses only on significant relationships between assets.
Dynamic Score Calculation: Scores are updated dynamically based on the timeframe and input settings, providing real-time insights into market behaviour.
Colour-Enhanced Results: The table display uses gradients to visually distinguish between leading and lagging assets, simplifying data interpretation.
Application
Portfolio Optimisation: Identifies influential assets to help traders allocate their portfolio effectively and reduce exposure to lagging assets.
Market Trend Identification: Highlights leading assets that may signal broader market trends, aiding in strategic decision-making.
Customised Trading Strategies: Adapts to various trading styles through extensive input settings, ensuring the analysis meets the specific needs of each trader.
The Lead-Lag Market Detector by is an essential tool for traders aiming to uncover market leaders and laggers, navigate complex market dynamics, and optimise their trading strategies with precision and insight.
Global Liquidity Index 10 Week LeadThis script is an extension of the Global Liquidity Index , incorporating a key modification: a 10-week lead adjustment.
The indicator values are shifted forward by 10 weeks, dynamically adapting to the chart's timeframe (daily, weekly, monthly). This adjustment plots the lead values ahead of the current time, offering a clearer visual alignment with potential future trends. The approach aligns with the theory explored and popularized by Michael Howell of CrossBorder Capital and Raoul Pal of Global Macro Investor, which suggests that Bitcoin typically lags global liquidity by approximately 8 to 12 weeks.
The Global Liquidity Index is calculated based on the following components:
Major Central Banks:
Federal Reserve System (FED) - Treasury General Account (TGA) - Reverse Repurchase Agreements (RRP) + European Central Bank (ECB) + People's Bank of China (PBC) + Bank of Japan (BOJ) + Bank of England (BOE) + Bank of Canada (BOC) + Reserve Bank of Australia (RBA) + Reserve Bank of India (RBI) + Swiss National Bank (SNB) + Central Bank of the Russian Federation (CBR) + Central Bank of Brazil (BCB) + Bank of Korea (BOK) + Reserve Bank of New Zealand (RBNZ) + Sweden's Central Bank (Riksbank) + Central Bank of Malaysia (BNM).
M2 Money Supply:
Includes M2 for the USA, Europe, China, Japan, UK, Canada, Australia, India, Switzerland, Russia, Brazil, Korea, Mexico, Indonesia, South Africa, Malaysia, and Sweden.
Fibonacci Trend [ChartPrime]Fibonacci Trend Indicator
This powerful indicator leverages supertrend analysis to detect market direction while overlaying dynamic Fibonacci levels to highlight potential support, resistance, and optimal trend entry zones. With its straightforward design, it is perfect for traders looking to simplify their workflow and enhance decision-making.
⯁ KEY FEATURES AND HOW TO USE
⯌ Supertrend Trend Identification :
The indicator uses a supertrend algorithm to identify market direction. It displays purple for downtrends and green for uptrends, ensuring quick and clear trend analysis.
⯌ Fibonacci Levels for Current Swings :
Automatically calculates Fibonacci retracement levels (0.236, 0.382, 0.618, 0.786) for the current swing leg.
- These levels act as key zones for potential support, resistance, and trend continuation.
- The high and low swing points are labeled with exact prices, ensuring clarity.
- If the swing range is insufficient (less than five times ATR), Fibonacci levels are not displayed, avoiding irrelevant data.
⯌ Extended Fibonacci Levels :
User-defined extensions project Fibonacci levels into the future, aiding traders in planning price targets or projecting key zones.
⯌ Optimal Trend Entry Zone :
A filled area between 0.618 and 0.786 levels visually highlights the optimal entry zone for trend continuation. This allows traders to refine their entry points during pullbacks.
⯌ Diagonal Trend Line :
A dashed diagonal line connects the swing high and low, visually confirming the range and trend strength of the current swing.
⯌ Visual Labels for Fibonacci Levels :
Each Fibonacci level is marked with a label displaying its value for quick reference.
⯁ HOW TRADERS CAN POTENTIALLY USE THIS TOOL
Fibonacci Retracements:
Use the Fibonacci retracement levels to find key support or resistance zones where the price may pull back before continuing its trend.
Example: Enter long trades when the price retraces to 0.618–0.786 levels in an uptrend.
Fibonacci Extensions:
Use Fibonacci extensions to project future price targets based on the current trend's swing leg. Levels like 127.2% and 161.8% are commonly used as profit-taking zones.
Reversal Identification:
Spot potential reversals by monitoring price reactions at key Fibonacci retracement levels (e.g., 0.236 or 0.382) or the swing high/low.
Optimal Trend Entries:
The filled zone between 0.618 and 0.786 is a statistically strong area for entering a position in the direction of the trend.
Example: Enter long positions during retracements to this range in an uptrend.
Risk Management:
Set stop-losses below key Fibonacci levels or the swing low/high, and take profits at extension levels, enhancing your trade management strategies.
⯁ CONCLUSION
The Fibonacci Trend Indicator is a straightforward yet effective tool for identifying trends and key Fibonacci levels. It simplifies analysis by integrating supertrend-based trend identification with Fibonacci retracements, extensions, and optimal entry zones. Whether you're a beginner or experienced trader, this indicator is an essential addition to your toolkit for trend trading, reversal spotting, and risk management.
SHUMILKIN Ai//@version=5
indicator('JohnScript', format=format.price, precision=4, overlay=true)
// Inputs
a = input(1, title='Чувствительность')
c = input(10, title='Период ATR')
h = input(false, title='Сигналы Heikin Ashi')
signal_length = input.int(title='Сглаживание', minval=1, maxval=200, defval=11)
sma_signal = input(title='Сигнальная линия (MA)', defval=true)
lin_reg = input(title='Линейная регрессия', defval=false)
linreg_length = input.int(title='Длина линейной регрессии', minval=1, maxval=200, defval=11)
// Линии Болинджера
bollinger = input(false, title='Боллинджер')
bolingerlength = input(20, 'Длина')
// Bollinger Bands
bsrc = input(close, title='Исходные данные')
mult = input.float(2.0, title='Смещение', minval=0.001, maxval=50)
basis = ta.sma(bsrc, bolingerlength)
dev = mult * ta.stdev(bsrc, bolingerlength)
upper = basis + dev
lower = basis - dev
plot(bollinger ? basis : na, color=color.new(color.red, 0), title='Bol Basic')
p1 = plot(bollinger ? upper : na, color=color.new(color.blue, 0), title='Bol Upper')
p2 = plot(bollinger ? lower : na, color=color.new(color.blue, 0), title='Bol Lower')
fill(p1, p2, title='Bol Background', color=color.new(color.blue, 90))
// EMA
len = input(title='Длина EMA', defval=50)
ema1 = ta.ema(close, len)
plot(ema1, color=color.new(color.yellow, 0), linewidth=2, title='EMA')
xATR = ta.atr(c)
nLoss = a * xATR
src = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : close
xATRTrailingStop = 0.0
iff_1 = src > nz(xATRTrailingStop , 0) ? src - nLoss : src + nLoss
iff_2 = src < nz(xATRTrailingStop , 0) and src < nz(xATRTrailingStop , 0) ? math.min(nz(xATRTrailingStop ), src + nLoss) : iff_1
xATRTrailingStop := src > nz(xATRTrailingStop , 0) and src > nz(xATRTrailingStop , 0) ? math.max(nz(xATRTrailingStop ), src - nLoss) : iff_2
pos = 0
iff_3 = src > nz(xATRTrailingStop , 0) and src < nz(xATRTrailingStop , 0) ? -1 : nz(pos , 0)
pos := src < nz(xATRTrailingStop , 0) and src > nz(xATRTrailingStop , 0) ? 1 : iff_3
xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue
ema = ta.ema(src, 1)
above = ta.crossover(ema, xATRTrailingStop)
below = ta.crossover(xATRTrailingStop, ema)
buy = src > xATRTrailingStop and above
sell = src < xATRTrailingStop and below
barbuy = src > xATRTrailingStop
barsell = src < xATRTrailingStop
plotshape(buy, title='Buy', text='Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(sell, title='Sell', text='Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)
barcolor(barbuy ? color.green : na)
barcolor(barsell ? color.red : na)
alertcondition(buy, 'UT Long', 'UT Long')
alertcondition(sell, 'UT Short', 'UT Short')
bopen = lin_reg ? ta.linreg(open, linreg_length, 0) : open
bhigh = lin_reg ? ta.linreg(high, linreg_length, 0) : high
blow = lin_reg ? ta.linreg(low, linreg_length, 0) : low
bclose = lin_reg ? ta.linreg(close, linreg_length, 0) : close
r = bopen < bclose
signal = sma_signal ? ta.sma(bclose, signal_length) : ta.ema(bclose, signal_length)
plotcandle(r ? bopen : na, r ? bhigh : na, r ? blow : na, r ? bclose : na, title='LinReg Candles', color=color.green, wickcolor=color.green, bordercolor=color.green, editable=true)
plotcandle(r ? na : bopen, r ? na : bhigh, r ? na : blow, r ? na : bclose, title='LinReg Candles', color=color.red, wickcolor=color.red, bordercolor=color.red, editable=true)
plot(signal, color=color.new(color.white, 0))