MACD-DEMA Screener (Manual DEMA)
MACD-DEMA generates weekly buy signals. With this indicator, you can generate early buy and sell signals.
Bands and Channels
TSLA + NQ1! MTF StrategyGreat! Here's an upgraded automated TradingView Pine Script (v5) strategy template with:
✅ Entry signals based on TSLA & NQ1! key levels
✅ RSI filter (momentum confirmation)
✅ Stop Loss / Take Profit
✅ Configurable Multi-Timeframe EMA filter (e.g., 1H)
ATR RopeATR Rope is inspired by DonovanWall's "Range Filter". It implements a similar concept of filtering out smaller market movements and adjusting only for larger moves. In addition, this indicator goes one step deeper by producing actionable zones to determine market state. (Trend vs. Consolidation)
> Background
When reading up on the Range Filter indicator, it reminded me exactly of a Rope stabilization drawing tool in a program I use frequently. Rope stabilization essentially attaches a fixed length "rope" to your cursor and an anchor point (Brush). As you move your cursor, you are pulling the brush behind it. The cursor (of course) will not pull the brush until the rope is fully extended, this behavior filters out jittery movements and is used to produce smoother drawing curves.
If compared visually side-by-side, you will notice that this indicator bears striking resemblance to its inspiration.
> Goal
Other than simply distinguishing price movements between meaningful and noise, this indicator strives to create a rigid structure to frame market movements and lack-there-of, such as when to anticipate trend, and when to suspect consolidation.
Since the indicator works based on an ATR range, the resulting ATR Channel does well to get reactions from price at its extremes. Naturally, when consolidating, price will remain within the channel, neither pushing the channel significantly up or down. Likewise, when trending, price will continue to push the channel in a single direction.
With the goal of keeping it quick and simple, this indicator does not do any smoothing of data feeds, and is simply based on the deviation of price from the central rope. Adjusting the rope when price extends past the threshold created by +/- ATR from the rope.
> Features & Behaviors
- ATR Rope
ATR Rope is displayed as a 3 color single line.
This can be considered the center line, or the directional line, whichever you'd prefer.
The main point of the Rope display is to indicate direction, however it also is factually the center of the current working range.
- ATR Rope Color
When the rope's value moves up, it changes to green (uptrend), when down, red (downtrend).
When the source crosses the rope, it turns blue (flat).
With these simple rules, we've formed a structure to view market movements.
- Consolidation Zones
Consolidation Zones generate from "Flat" areas, and extend into subsequent trend areas. Consolidation is simply areas where price has crossed the Rope and remains inside the range. Over these periods, the upper and lower values are accumulated and averaged together to form the "Consolidation Zone" values. These zones are draw live, so values are averaged as the flat areas progress and don't repaint, so all values seen historically are as they would appear live.
- ATR Channel
ATR Channel displays the upper and lower bounds of the working range.
When the source moves beyond this range, the rope is adjusted based on the distance from the source to the channel. This range can be extremely useful to view, but by default it is hidden.
> Application
This indicator is not created to provide signals, or serve as a "complete" system.
(People who didn't read this far will still comment for signals. :) )
This is created to be used alongside manual interpretation and intuition. This indicator is not meant to constrain any users into a box, and I would actually encourage an open mind and idea generation, as the application of this indicator can take various forms.
> Examples
As you would probably already know, price movement can be fast impulses, and movement can be slow bleeds. In the screenshot below, we are using movements from and to consolidation zones to classify weak trend and strong trend. As you can see, there are also areas of consolidation which get broken out of and confirmed for the larger moves.
Author's Note: In each of these examples, I have outlined the start and end of each session. These examples come from 1 Min Future charts, and have specifically been framed with day trading in mind.
"Breakout Retest" or "Support/Resistance Flips" or "Structure Retests" are all generally the same thing, with different traders referring to them by different names, all of which can be seen throughout these examples.
In the next example, we have a day which started with an early reversal leading into long, slow, trend. Notice how each area throughout the trend essentially moves slightly higher, then consolidates while holding support of the previous zone. This day had a few sharp movements, however there was a large amount of neutrality throughout this day with continuous higher lows.
In contrast to the previous example, next up, we have a very choppy day. Throughout which we see a significant amount of retests before fast directional movements. We also see a few examples of places where previous zones remained relevant into the future. While the zones only display into the resulting trend area, they do not become immediately meaningless once they stop drawing.
> Abstract
In the screenshot below, I have stacked 2 of these indicators, using the high as the source for one and the low as the source for the other. I've hidden lines of the high and low channels to create a 4 lined channel based on the wicks of price.
This is not necessary to use the indicator, but should help provide an idea of creative ways the simple indicator could be used to produce more complicated analysis.
If you've made it this far, I would hope it's clear to you how this indicator could provide value to your trading.
Thank you to DonovonWall for the inspiration.
Enjoy!
Mandelbrot Risk Bands (Dynamic Chart-Scaled)I used Chatgpt to come up with a Madelbrot style risk bands. Thought process is similar to how Hedgeye thinks about the markets. I am currently having issues with the script not updating or scaling so if there are any ideas please let me know.
Honor.Trading - Cruce EMAs solo en Tendencia//@version=5
indicator("Honor.Trading - Cruce EMAs solo en Tendencia", overlay=true)
ema6 = ta.ema(close, 6)
ema9 = ta.ema(close, 9)
ema50 = ta.ema(close, 50)
plot(ema6, color=color.orange, title="EMA 6")
plot(ema9, color=color.blue, title="EMA 9")
plot(ema50, color=color.gray, title="EMA 50")
tendenciaAlcista = ema6 > ema50 and ema9 > ema50
tendenciaBajista = ema6 < ema50 and ema9 < ema50
mercadoLateral = not tendenciaAlcista and not tendenciaBajista
crossUp = ta.crossover(ema6, ema50) and ta.crossover(ema9, ema50)
crossDown = ta.crossunder(ema6, ema50) and ta.crossunder(ema9, ema50)
// === ENTRADAS VALIDANDO TENDENCIA === //
longEntry = crossUp and tendenciaAlcista
shortEntry = crossDown and tendenciaBajista
pip = syminfo.mintick * 10
long_tp = close + 15 * pip
long_sl = ema50 - 6 * pip
short_tp = close - 15 * pip
short_sl = ema50 + 6 * pip
plotshape(longEntry, title="Entrada Compra", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(shortEntry, title="Entrada Venta", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
plot(longEntry ? long_tp : na, title="TP Compra", color=color.green, style=plot.style_cross, linewidth=2)
plot(longEntry ? long_sl : na, title="SL Compra", color=color.red, style=plot.style_cross, linewidth=2)
plot(shortEntry ? short_tp : na, title="TP Venta", color=color.green, style=plot.style_cross, linewidth=2)
plot(shortEntry ? short_sl : na, title="SL Venta", color=color.red, style=plot.style_cross, linewidth=2)
alertcondition(longEntry, title="Alerta Entrada Compra", message="🚀 Entrada en COMPRA: EMAs 6 y 9 cruzan EMA 50 en tendencia alcista")
alertcondition(shortEntry, title="Alerta Entrada Venta", message="📉 Entrada en VENTA: EMAs 6 y 9 cruzan EMA 50 en tendencia bajista")
Million Moves Algo v4.3🧠 Million Moves Algo v4.3 – Technical Description
🎯 General Purpose
The "Million Moves Algo v4.3" is a multi-functional trading indicator designed to identify high-probability buy and sell signals, combining trend-following, reversal detection, and volatility analysis. It’s built for both day trading and swing trading, with a strong focus on signal clarity and adaptability.
🧩 Core Components
✅ 1. Main Trade Signals
Buy/Sell Signals:
Triggered by crossovers with a customized SuperTrend algorithm.
Filtered using short-term SMAs (8, 9, 13) and signal strength (measured relative to ATR).
Includes spacing control (signalSpacing) to avoid cluttering the chart.
Two display modes:
"All Signals": shows all valid signals.
"Smart Signals": filters and displays only the strongest/high-conviction signals.
Reversal Signals (Reversal Up / Reversal Down):
Based on RSI crossovers with overbought/oversold levels (75/25).
Trigger only if signal strength and spacing filters are met.
Ideal for identifying early trend shifts.
✅ 2. Trend Management Tools
200 EMA: used as a long-term trend filter.
Trend Ribbon:
A visual trend band made of multiple EMAs (25 to 55).
Colors shift dynamically: pink for bullish trends, cyan for bearish.
Trend Cloud:
Formed by EMAs 150 and 250.
Green when EMA150 > EMA250, red when the opposite.
Chaos Trend Line:
Uses EMA(20) and EMA(55) crossover to define overall trend direction (uptrend or downtrend).
✅ 3. Informative Dashboard
Displays:
Current volatility level (Very Low, Low, High, Very High), based on a custom ATR/stdev formula.
RSI value in real-time, with green if RSI > 50 and red if RSI < 50.
Users can customize the position and size of the dashboard.
✅ 4. Optional: Risk Management with TP/SL
Built-in section prepared to show:
Take-Profit levels: TP1, TP2, TP3
Stop Loss based on ATR multiples.
Risk module is present but not fully implemented visually yet.
Can be enabled through the input panel (riskmanage, tpstrength).
⚙️ Key Customizable Parameters
Signal Sensitivity: Controls frequency of signal triggers (higher = fewer signals).
Minimum bar spacing between signals.
Signal strength filter (based on distance from SuperTrend).
Candle color/style: options include trend-based, MA-based, or "CleanScalper".
Enable/disable visual tools: Trend ribbon, trend cloud, chaos line, moving average, dashboard, etc.
🔔 Alerts
The script includes ready-to-use conditions for:
Buy Signals
Sell Signals
Reversal Up
Reversal Down
These are currently commented out but can be activated by simply uncommenting the alertcondition() lines.
👨💻 Best Suited For...
Intraday traders operating on short timeframes (1min, 5min, 15min, 1h).
Swing traders seeking strong trend confirmation or early reversal opportunities.
Traders who prefer a structured, visual trading system with customizable behavior.
Vertical Lines Every 12 Hours//@version=5
indicator("Vertical Lines Every 12 Hours", overlay=true)
// Get the current time in milliseconds since the Unix epoch
currentTime = time
// Calculate 12 hours in milliseconds (12 hours * 60 minutes/hour * 60 seconds/minute * 1000 milliseconds/second)
twelveHoursInMs = 12 * 60 * 60 * 1000
// Determine the timestamp of the last 12-hour mark
// We use 'time / twelveHoursInMs' to get the number of 12-hour blocks since epoch,
// then multiply by 'twelveHoursInMs' to get the start of the current 12-hour block.
// Adding 'twelveHoursInMs' ensures we plot at the *next* 12-hour mark.
// The modulo operator '%' helps us check if the current bar's time is exactly
// at a 12-hour interval relative to the start of the current day.
// This approach tries to align the lines consistently.
// A more robust way to do this is to check if the hour changes to 00:00 or 12:00 UTC (or your preferred timezone)
// and plot a line then. However, for "every 12 hours" relative to the chart's start,
// a simple time-based check is often sufficient.
// Let's refine the logic to hit specific 12-hour intervals like 00:00 and 12:00 daily (UTC as an example).
// You might need to adjust the timezone based on your chart's time zone settings and your preference.
// Get the hour of the day for the current bar's timestamp
hourOfDay = hour(time, "GMT") // "GMT" for UTC, adjust as needed (e.g., "America/New_York", "Asia/Jerusalem")
// Plot a vertical line if the hour is 0 (midnight) or 12 (noon)
if hourOfDay == 0 or hourOfDay == 12
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, extend=extend.both, color=color.blue, width=1)
Fester prozentualer Abstand zum Kursthe indicator delivers a fixed percent distance to the market price, made with AI support
Power IndicatorThe Power Indicator is a customizable EMA (Exponential Moving Average) overlay designed to help traders visually assess market trends across short-, medium-, and long-term timeframes. It plots five key EMAs — 10, 20, 50, 100, and 200 — directly on your price chart, providing a quick glance at the overall momentum and structure of the market.
Functionality:
This indicator includes the following features:
Five EMAs Plotted:
- EMA 10 → Short-term trend
- EMA 20 → Near-term trend
- EMA 50 → Medium-term trend
- EMA 100 → Intermediate trend
- EMA 200 → Long-term trend
User-defined Colors:
Each EMA has its own color setting, allowing full customization for better visibility and style matching.
🖥️Overlay on Price Chart:
EMAs are drawn directly over candles to align with your trading chart.
Real-Time Updates:
EMAs update dynamically with every new price bar.
⚙️ How to Use & Modify Settings
To customize the indicator:
- Add the indicator to your chart.
- Click the gear icon (⚙️) next to the script name.
- Under the Inputs tab, you'll see:
- EMA 10 Color – Choose your preferred color
- EMA 20 Color – Choose your preferred color
- EMA 50 Color – Choose your preferred color
- EMA 100 Color – Choose your preferred color
- EMA 200 Color – Choose your preferred color
You can adjust the colors to match your theme or emphasize specific EMAs.
RCI Ribbon with Cross Signals (Filtered)nothing to say just use itnothing to say just use itnothing to say just use itnothing to say just use it
AlphaTrend AutoTrade PRO v3.1//@version=5
// ---------------------------------------------------------------------------
// AlphaTrend AutoTrade PRO v3.1 (compile‑safe, dynamic lot)
// ---------------------------------------------------------------------------
// – Fixed Lot OR %Equity sizing via runtime `qty` parameter
// – ATR-based SL/TP + optional Trailing
// – Optional filters (HTF-RSI, Session, Weekday)
// – Webhook JSON + Debug Shapes
// ---------------------------------------------------------------------------
//──────────────────────── ① Order Size Mode ─────────────────────────
accountMode = input.string("Fixed", "Order Size Mode", options= )
fixedLot = input.float(1.0, "Fixed Lot Size", step=0.1)
riskPct = input.float(1.0, "% Equity Risk per Trade (if Percent)", step=0.1)
// Strategy header must use constant; we pick FIXED 1 lot as default placeholder
strategy("AlphaTrend AutoTrade PRO v3.1", overlay=true,
default_qty_type=strategy.fixed,
default_qty_value=1,
initial_capital=10000,
currency=currency.USD,
calc_on_every_tick=false,
max_bars_back=500)
// Helper to compute dynamic qty each entry
calcQty(bool isLong) =>
accountMode == "Fixed" ? fixedLot :
// Percent equity: qty = (equity * pct) / price
(strategy.equity * (riskPct/100.0)) / close
//──────────────────────── ② AlphaTrend & Risk Inputs ───────────────
atrMult = input.float(1.0, "ATR Multiplier", step=0.05)
atrLen = input.int(14, "ATR Period")
slATR = input.float(1.2, "SL × ATR")
tpATR = input.float(1.8, "TP × ATR")
trailOn = input.bool(true, "Enable Trailing")
trailStart= input.float(1.5, "Trail Start × ATR")
trailOffset= input.float(1.0, "Trail Offset × ATR")
//──────────────────────── ③ Filters ────────────────────────────────
htfEnable = input.bool(false, "Higher‑TF RSI filter")
htfTF = input.timeframe("15", "Higher‑TF TF")
rsithreshold= input.int(50, "HTF RSI Threshold", minval=10, maxval=90)
sessEnable = input.bool(false, "Session filter (Bangkok)")
sessionStr = input.session("1300-2300", "Active HHMM‑HHMM")
dowEnable = input.bool(false, "Filter by Weekday")
tradeDays = input.string("12345", "Trade days (1=Mon)")
showDebug = input.bool(true, "Show Debug Shapes")
secretToken = input.string("MYSECRET", "Webhook Token")
//──────────────────────── ④ AlphaTrend Calc ───────────────────────
atr = ta.sma(ta.tr, atrLen)
upT = low - atr*atrMult
dnT = high + atr*atrMult
var float at = na
condUp = ta.rsi(close, atrLen) >= 50
at := condUp ? math.max(nz(at , upT), upT) : math.min(nz(at , dnT), dnT)
rawLong = ta.crossover(at, at )
rawShort = ta.crossunder(at, at )
htfPassLong = not htfEnable or request.security(syminfo.tickerid, htfTF, ta.rsi(close, atrLen) > rsithreshold)
htfPassShort = not htfEnable or request.security(syminfo.tickerid, htfTF, ta.rsi(close, atrLen) < rsithreshold)
sessPass = not sessEnable or not na(time(timeframe.period, sessionStr))
dowPass = not dowEnable or str.contains(tradeDays, str.tostring(dayofweek))
longCond = rawLong and htfPassLong and sessPass and dowPass
shortCond = rawShort and htfPassShort and sessPass and dowPass
//──────────────────────── ⑤ Risk Params ───────────────────────────
slPts = atr*slATR
tpPts = atr*tpATR
trailP = trailOn ? atr*trailStart : na
trailO = trailOn ? atr*trailOffset : na
lotDesc = accountMode=="Fixed" ? str.tostring(fixedLot) : str.tostring(riskPct)+"%"
//──────────────────────── ⑥ Execute & Webhook ─────────────────────
if longCond
lot = calcQty(true)
strategy.entry("L", strategy.long, qty=lot)
strategy.exit("XL", from_entry="L", stop=close-slPts, limit=close+tpPts, trail_points=trailP, trail_offset=trailO)
if barstate.isconfirmed and barstate.isrealtime
msg = '{"token":"'+secretToken+'","action":"buy","symbol":"'+syminfo.ticker+'","price":'+str.tostring(close)+',"sl":'+str.tostring(close-slPts)+',"tp":'+str.tostring(close+tpPts)+',"lot":"'+lotDesc+'"}'
alert(msg, alert.freq_once_per_bar_close)
if shortCond
lot = calcQty(false)
strategy.entry("S", strategy.short, qty=lot)
strategy.exit("XS", from_entry="S", stop=close+slPts, limit=close-tpPts, trail_points=trailP, trail_offset=trailO)
if barstate.isconfirmed and barstate.isrealtime
msg = '{"token":"'+secretToken+'","action":"sell","symbol":"'+syminfo.ticker+'","price":'+str.tostring(close)+',"sl":'+str.tostring(close+slPts)+',"tp":'+str.tostring(close-tpPts)+',"lot":"'+lotDesc+'"}'
alert(msg, alert.freq_once_per_bar_close)
//──────────────────────── ⑦ Debug Shapes ──────────────────────────
plotshape(rawLong and showDebug, title="RawLong", style=shape.circle, location=location.belowbar, color=color.aqua, size=size.tiny)
plotshape(rawShort and showDebug, title="RawShort", style=shape.circle, location=location.abovebar, color=color.purple, size=size.tiny)
plotshape(longCond and showDebug, title="LongOK", style=shape.arrowup, location=location.belowbar, color=color.green)
plotshape(shortCond and showDebug, title="ShortOK", style=shape.arrowdown, location=location.abovebar, color=color.red)
//──────────────────────── ⑧ Plot AlphaTrend ───────────────────────
col = at > at ? color.green : color.red
plot(at, "AlphaTrend", color=col, linewidth=3)
plot(at , "AlphaTrendLag", color=color.new(col,70), linewidth=2)
Euclidean Range [InvestorUnknown]The Euclidean Range indicator visualizes price deviation from a moving average using a geometric concept Euclidean distance. It helps traders identify trend strength, volatility shifts, and potential overextensions in price behavior.
Euclidean Distance
Euclidean distance is a fundamental concept in geometry and machine learning. It measures the "straight-line distance" between two points in space. In time series analysis, it can be used to measure how far one sequence deviates from another over a fixed window.
euclidean_distance(src, ref, len) =>
var float sum_sq_diff = na
sum_sq_diff := 0.0
for i = 0 to len - 1
diff = src - ref
sum_sq_diff += diff * diff
math.sqrt(sum_sq_diff)
In this script, we calculate the Euclidean distance between the price (source) and a smoothed average (reference) over a user-defined window. This gives us a single scalar that reflects the overall divergence between price and trend.
How It Works
Moving Average Calculation: You can choose between SMA, EMA, or HMA as your reference line. This becomes the "baseline" against which the actual price is compared.
Distance Band Construction: The Euclidean distance between the price and the reference is calculated over the Window Length. This value is then added to and subtracted from the average to form dynamic upper and lower bands, visually framing the range of deviation.
Distance Ratios and Z-Scores: Two distance ratios are computed: dist_r = distance / price (sensitivity to volatility); dist_v = price / distance (sensitivity to compression or low-volatility states)
Both ratios are normalized using a Z-score to standardize their behavior and allow for easier interpretation across different assets and timeframes.
Z-Score Plots: Z_r (white line) highlights instances of high volatility or strong price deviation; Z_v (red line) highlights low volatility or compressed price ranges.
Background Highlighting (Optional): When Z_v is dominant and increasing, the background is colored using a gradient. This signals a possible build-up in low volatility, which may precede a breakout.
Use Cases
Detect volatile expansions and calm compression zones.
Identify mean reversion setups when price returns to the average.
Anticipate breakout conditions by observing rising Z_v values.
Use dynamic distance bands as adaptive support/resistance zones.
Notes
The indicator is best used with liquid assets and medium-to-long windows.
Background coloring helps visually filter for squeeze setups.
Disclaimer
This indicator is provided for speculative analysis and educational purposes only. It is not financial advice. Always backtest and evaluate in a simulated environment before live trading.
TeeLek-HedgingRibbonIf we are DCA some assets and it happens to be in a downtrend, sitting and waiting is the best way, but it is not easy to do. There are other ways that allow us to buy DCA and keep collecting more. While the market is falling, don't be depressed. The more you buy, the more it drops. Should you continue buying? Plus, if it goes back to an uptrend, you will also get extra profit. Let's go check it out.
ถ้าเรา DCA ทรัพย์สินอะไรซักอย่างนึงอยู่ แล้วมันดันเป็นขาลงพอดี จะนั่งรอเฉยๆ เป็นวิธีที่ดีที่สุด แต่ไม่ได้ทำกันได้ง่ายๆ นะ ยังมีวิธีอื่นอีก ที่ให้เราสามารถ ซื้อ DCA เก็บของเพิ่มได้เรื่อยๆ ระหว่างที่ตลาดร่วง ไม่จิตตก ยิ่งซื้อ ยิ่งลง จะซื้อต่อดีไหม? แถมถ้า กลับมาเป็นขาขึ้น ยังมีกำไรแถมให้ด้วยนะ ไปหาดูกัน
Fallback VWAP (No Volume? No Problem!) – Yogi365Fallback VWAP (No Volume? No Problem!) – Yogi365
This script plots Daily, Weekly, and Monthly VWAPs with ±1 Standard Deviation bands. When volume data is missing or zero (common in indices or illiquid assets), it automatically falls back to a TWAP-style calculation, ensuring that your VWAP levels always remain visible and accurate.
Features:
Daily, Weekly, and Monthly VWAPs with ±1 Std Dev bands.
Auto-detection of missing volume and seamless fallback.
Clean, color-coded trend table showing price vs VWAP/bands.
Uses hlc3 for VWAP source.
Labels indicate when fallback is used.
Best Used On:
Any asset or index where volume is unavailable.
Intraday and swing trading.
Works on all timeframes but optimized for overlay use.
How it Works:
If volume == 0, the script uses a constant fallback volume (1), turning the VWAP into a TWAP (Time-Weighted Average Price) — still useful for intraday or index-based analysis.
This ensures consistent plotting on instruments like indices (e.g., NIFTY, SENSEX,DJI etc.) which might not provide volume on TradingView.
SuperTrend Adaptive (STD Smooth)Supertrend DeNoise (StdDev + Smoothing) is an advanced trend-following indicator designed to reduce false signals and market noise. This version enhances the classic Supertrend by incorporating standard deviation into the channel calculation and a smoothing factor, making the bands wider and more adaptive to volatility. The result is fewer whipsaws and clearer, more robust trend signals. Buy and sell labels appear only at the latest signal, keeping your chart uncluttered and focused. Ideal for traders seeking a cleaner trend indicator for any timeframe.
Gold Buy/Sell Signals with Engulfing & S&D ZonesTrade base on the Fast & Slow Moving Average. When the Fast MA line is below the candle, it is an uptrend to BUY. if Fast MA line is above the candle, it's time to SELL.
Multi MA 10 Lines PRO (Custom Label + Crossover Icon)Multi MA 10 Lines PRO – 10 Custom MAs, Dynamic Labels & Persistent Crossover Symbols
The ultimate professional Moving Average indicator — plot up to 10 fully customizable MAs (type, timeframe, color, width, style), display live price labels (value, % distance, or custom text), plus advanced ATR cross markers on every crossover (MA1/MA2).
NEW: All MA crossovers are marked with persistent symbols (choose icon, color, size) — instantly spot every golden/death cross in your backtest! Complete flexibility for scalpers, swing traders, and serious strategists.
AD Pro//@version=5
indicator("AD Pro", overlay=true)
// === Inputs
atrLen = input.int(14, "ATR Length")
factor = input.float(0.7, "Factor")
slMultiplier = input.float(2.0, "SL Multiplier")
// Volatility Filter Input
atrFilterStrength = input.float(1.0, "Volatility Threshold (x Avg ATR)", step=0.1, minval=0.1)
// Min % Price Change Filter
enableMinMove = input.bool(true, "Enable Min % Price Change Filter")
lookbackBars = input.int(20, "Lookback Bars")
minMovePct = input.float(0.005, "Min % Price Change", step=0.001, minval=0)
// TP Buy colors
tp1BuyColor = input.color(color.lime, "TP1 Buy Color")
tp2BuyColor = input.color(color.green, "TP2 Buy Color")
tp3BuyColor = input.color(color.teal, "TP3 Buy Color")
// TP Sell colors
tp1SellColor = input.color(color.fuchsia, "TP1 Sell Color")
tp2SellColor = input.color(color.red, "TP2 Sell Color")
tp3SellColor = input.color(color.maroon, "TP3 Sell Color")
// SL colors
slBuyColor = input.color(color.blue, "SL Buy Color")
slSellColor = input.color(color.blue, "SL Sell Color")
// === Indicator Calculations
atr = ta.atr(atrLen)
avgATR = ta.sma(atr, 50)
atrCondition = atr > avgATR * atrFilterStrength
priceChange = math.abs(close - close ) / close
priceMoveOK = priceChange > minMovePct
priceChangeCondition = not enableMinMove or priceMoveOK
volatilityOK = atrCondition and priceChangeCondition
// === UT Bot Logic
src = close
var float trailPrice = na
var bool dirLong = true
longStop = src - factor * atr
shortStop = src + factor * atr
if na(trailPrice)
trailPrice := longStop
dirLong := true
else
if dirLong
trailPrice := math.max(trailPrice, longStop)
dirLong := src > trailPrice
else
trailPrice := math.min(trailPrice, shortStop)
dirLong := src > trailPrice
rawBuy = dirLong and not dirLong
rawSell = not dirLong and dirLong
// Apply Volatility Filter
buySignal = rawBuy and volatilityOK
sellSignal = rawSell and volatilityOK
// === Entry & Label Storage
var float entryPrice = na
var bool lastSignalIsBuy = na
var label tp1Lbl = na
var label tp2Lbl = na
var label tp3Lbl = na
var label slLbl = na
var line tp1Line = na
var line tp2Line = na
var line tp3Line = na
var line slLine = na
if buySignal or sellSignal
if not na(tp1Lbl)
label.delete(tp1Lbl)
if not na(tp2Lbl)
label.delete(tp2Lbl)
if not na(tp3Lbl)
label.delete(tp3Lbl)
if not na(slLbl)
label.delete(slLbl)
if not na(tp1Line)
line.delete(tp1Line)
if not na(tp2Line)
line.delete(tp2Line)
if not na(tp3Line)
line.delete(tp3Line)
if not na(slLine)
line.delete(slLine)
entryPrice := close
lastSignalIsBuy := buySignal
tp1 = entryPrice + (buySignal ? 1 : -1) * atr
tp2 = entryPrice + (buySignal ? 2 : -2) * atr
tp3 = entryPrice + (buySignal ? 3 : -3) * atr
sl = entryPrice - (buySignal ? 1 : -1) * factor * atr * slMultiplier
tp1Lbl := label.new(bar_index, tp1, "TP1 " + str.tostring(tp1, format.mintick),
style=label.style_label_right,
color=buySignal ? tp1BuyColor : tp1SellColor,
textcolor=color.black)
tp2Lbl := label.new(bar_index, tp2, "TP2 " + str.tostring(tp2, format.mintick),
style=label.style_label_right,
color=buySignal ? tp2BuyColor : tp2SellColor,
textcolor=color.white)
tp3Lbl := label.new(bar_index, tp3, "TP3 " + str.tostring(tp3, format.mintick),
style=label.style_label_right,
color=buySignal ? tp3BuyColor : tp3SellColor,
textcolor=color.white)
slLbl := label.new(bar_index, sl, "SL " + str.tostring(sl, format.mintick),
style=label.style_label_right,
color=buySignal ? slBuyColor : slSellColor,
textcolor=color.white)
tp1Line := line.new(bar_index, tp1, bar_index + 1, tp1,
color=buySignal ? tp1BuyColor : tp1SellColor, style=line.style_dashed)
tp2Line := line.new(bar_index, tp2, bar_index + 1, tp2,
color=buySignal ? tp2BuyColor : tp2SellColor, style=line.style_dashed)
tp3Line := line.new(bar_index, tp3, bar_index + 1, tp3,
color=buySignal ? tp3BuyColor : tp3SellColor, style=line.style_dashed)
slLine := line.new(bar_index, sl, bar_index + 1, sl,
color=buySignal ? slBuyColor : slSellColor, style=line.style_dashed)
// === Plot Signals
plotshape(buySignal, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === Alerts
alertcondition(buySignal, title="Buy Alert", message="Buy Signal!")
alertcondition(sellSignal, title="Sell Alert", message="Sell Signal!")