Smart PA Early Entry - Trend StartSmart PA Early Entry Indicator (MACD + FVG + Fibonacci)
This TradingView indicator helps traders spot potential trend reversals early by combining multiple technical tools:
MACD Momentum – Identifies the direction of the trend.
Volume Filter – Confirms strong market participation for reliable signals.
Fair Value Gaps (FVG) – Highlights areas where price may reverse or continue strongly.
Fibonacci Retracement Levels – Pinpoints key support/resistance zones for early entries.
ATR-based Stop Loss – Automatically calculates a dynamic stop-loss based on market volatility.
Trend Start Signals – Alerts only appear on the first candle of a potential trend change to avoid repeated signals.
Visual Labels & Plots – Shows entry price, stop-loss, FVG zones, and Fibonacci levels for easy chart reading.
Ideal for: Intraday and swing traders looking for high-probability entries near trend reversals with clear risk management.
지표 및 전략
60 신저가 숏_신저가“60-Day New Low Short (New Low)” is a momentum breakdown setup that sells short when price prints a fresh 60-day low, aiming to ride continued weakness after support fails.
Enter on the breakdown close (or next open) with confirmation such as expanding volume, relative weakness vs. a benchmark, and price below the 50/200-day MAs.
Manage risk with a stop above the recent swing high or 20-day high; take profits via ATR-based targets or a trailing stop, and be cautious around earnings/news catalysts.
60 신고가 롱_신고가“60-Day New High Long (New High)” is a momentum breakout setup that buys when price prints a fresh 60-day high, expecting continuation once resistance gives way.
Enter on the breakout close (or next open) with confirmation such as expanding volume, relative strength vs. a benchmark, and price above the 50/200-day MAs.
Manage risk with a stop below the recent swing low or 20-day low; take profits via ATR-based targets or a trailing stop, and be cautious around earnings/news catalysts.
IFVG LightOnly show IFVG. When FVG get inverted, IFVG box will be displayed in orange with a rocket icon
PQL v1PQL v1 — Levels + Initial Balance (RTH)
This indicator combines custom price levels plotting (PQL) with the Initial Balance (IB) for the US Regular Trading Hours (RTH).
Features:
• Daily & Weekly Levels provided by Prophet Quant
• Supports HV, R, S, EXT-R/S, PSY levels.
• Weekly levels with adjustable transparency.
• Optional price labels with customizable font size, offsets, and transparency.
• Initial Balance (RTH)
• Automatically detects the first X minutes after the RTH open (default 60 mins)
• Plots IB High, IB Low, and optional IB Midline.
• IB lines are drawn the same way as PQL levels: fixed-span horizontal lines.
• After 16:00, the IB levels are replaced with short stub markers on the right edge.
Customization:
• Full styling control (colors, line styles, widths, transparency).
• Toggle price labels on/off independently for both PQL and IB.
• Adjustable RTH timezone offset.
• Adjustable extension length of lines to the right.
60 신고가 롱“60-Day New High Long” is a momentum breakout strategy that buys when price makes a fresh 60-day high, expecting continuation after resistance gives way.
Enter on the breakout close (or next open) with confirmation such as expanding volume, relative strength vs. a benchmark, and price above the 50/200-day MAs.
Manage risk with a stop below the recent swing low or 20-day low; take profits via ATR-based targets or a trailing stop, and be cautious around binary catalysts (earnings/news).
60 신저가 숏“60-Day New Low Short” is a momentum breakdown setup that sells short when price prints a fresh 60-day low, betting that failed support will extend the downtrend.
Entries are usually taken on the breakdown close (or next open) with confirmation like rising volume, relative weakness, and price below the 50/200-day MAs.
Manage risk with a stop above the recent swing high or 20-day high; take profits via ATR-based targets or a trailing stop, and avoid trades near major catalysts (earnings/news).
Multi Triple EMA Crossover [Salamun]Multi EMA Crossover Indicator Function:
1. Identifying Trends:
Short EMA (7, 10, 20) for short term trend
Intermediate EMA (30, 60, 100) for intermediate trends
Long EMA (200) for long term trend
The shorter the EMA period, the more sensitive it is to price changes.
2. Providing Entry/Exit Signals:
Green Arrow (BUY) : When fast EMA crosses above slow EMA = bullish momentum
Red Arrow (SELL) : When the fast EMA crosses below the slow EMA = bearish momentum
How to Read Indicators:
✅ Bullish Condition:
Price is above the majority of EMA
The short EMA is above the long EMA
Light green background
A green arrow appears.
❌ Bearish Condition:
Price is below the majority of EMA
The short EMA is below the long EMA
Pink background
A red arrow appears
📊 Tips Trading:
Trend confirmation : Make sure the EMAs are in sequence (EMA7 > EMA10 > EMA20 for uptrend)
Support/Resistance : EMA can function as dynamic support/resistance
Signal filter : Use higher timeframe for confirmation
Risk management : Do not trade against the 200 EMA trend.
The table on the top right displays the real-time values of all EMAs and the current trend status for easy quick analysis.
OSOK KatxumotoThe OSOK Dynamic Box Enhanced is designed for scalpers and traders using the OSOK (One Shot, One Kill) method on futures like the NQ.
Features include:
A midline that dynamically follows the current price in real-time.
Upper (LS) and lower (LI) protection lines at configurable distances from the current price, representing stop or protection levels.
Target lines offset from LS and LI according to your risk/reward strategy, also fully configurable.
Customizable colors and thickness for all lines, allowing you to adapt the visualization to your trading style.
All lines automatically extend to the right from the current price, keeping the chart clean without accumulating old lines.
This indicator helps traders quickly visualize key levels, manage risk, and set objectives efficiently—perfect for scalping and high-precision setups.
Configurable parameters:
Protection distance (LS/LI) in points
Target distance from LS/LI in points
Line colors and thickness
Line extension to the right
Trend Strength Confidence Gauge LiteMost traders don’t fail from bad charts — they fail from bad timing. Jumping in too early, bailing too soon, or freezing when the move finally comes.
The Trend Strength Confidence Meter strips away the noise and highlights the three factors that matter most:
Trend → The confirmed direction of the market
Confidence → Concise tool clarity providing quick entries
Strength → Strength Score shows the underlying battle between buyers and sellers
How to Use It:
Watch the Moving Average Ribbon (Hull MA) for a flip: green = uptrend, red = downtrend.
Act only when ribbon color matches the Confidence thumbs-up.
Confirm with Strength 3+ before entry.
When trend, confidence, and strength align, you reduce risk and step in at tighter entry points — giving clarity for entries and conviction to hold through stronger moves.
Advanced Indicators Made Simple — Provided by The AI Trading Desk
VXN Money Flow IndexThis indicator is based on other open source scripts. It's designed for trading Nasdaq futures (NQ and MNQ). It generates trading signals using the Money Flow Index (MFI), which measures buying and selling pressure based on price and volume. The VXN index (CBOE Nasdaq Volatility Index) filters signals to align with market sentiment.
- MFI Signals: Bullish signals occur when MFI crosses above the 20 level (oversold) and the VXN background is green (bullish sentiment). Bearish signals occur when MFI crosses below the 80 level (overbought) and the VXN background is red (bearish sentiment).
- VXN Filter: The background is green when the VXN 1-period EMA is below the 200-period SMA (bullish), and red when the EMA is above the SMA (bearish).
Usage: Apply this indicator to a Nasdaq futures chart in TradingView. Take long trades on MFI crossovers above 20 when the background is green, and short trades on MFI crossunders below 80 when the background is red. Signals are plotted as triangles on the price chart.
Crypto Strength MatrixOverview
The "Crypto Strength Matrix" is a custom Pine Script v5 indicator designed for cryptocurrency traders to assess the relative strength of major crypto market segments against traditional markets (e.g., the U.S. Dollar Index) and Bitcoin dominance. This indicator plots the strength of Altcoins (excluding ETH and SOL), Ethereum (ETH), Solana (SOL), the Dollar Index (DXY) versus Altcoins, and Bitcoin Dominance (DOM) on a 0-100 scale, using the Relative Strength Index (RSI) methodology. It provides a visual and intuitive way to identify overbought (>70) or oversold (<30) conditions across these assets, helping traders spot potential entry or exit points in the crypto market.
How It Works
The indicator fetches real-time data from various crypto and forex symbols available on TradingView, including:
CRYPTOCAP:TOTAL2 (total altcoin market cap),
CRYPTOCAP:ETH and CRYPTOCAP:SOL (market caps of ETH and SOL),
CRYPTO:ETHUSD and CRYPTO:SOLUSD (ETH and SOL prices),
CRYPTOCAP:BTC.D (Bitcoin dominance),
TVC:DXY (U.S. Dollar Index).
Calculations:
Altcoin Strength (OTH): Measures the RSI of the normalized market cap of all altcoins excluding ETH and SOL (calculated as TOTAL2 - ETH - SOL), relative to the total altcoin market cap. This reflects the strength of smaller altcoins.
ETH Strength: Computes the RSI of ETH/USD price adjusted by the DXY, isolating ETH's performance against the dollar.
SOL Strength: Similar to ETH, calculates the RSI of SOL/USD price adjusted by the DXY, focusing on Solana's strength.
DXY vs Altcoins: Uses the RSI of the DXY divided by the normalized total altcoin market cap, indicating the dollar's strength relative to altcoins.
Bitcoin Dominance (DOM): Directly applies RSI to Bitcoin dominance data, showing BTC's market control.
Each metric is plotted as a line with a unique color (OTH in aqua, ETH in teal, SOL in purple, DXY in green, DOM in orange) and labeled at the end of the chart for easy identification. Horizontal lines at 70 (overbought), 50 (neutral), and 30 (oversold) provide reference levels.
How to Use
Add the Indicator: Apply the "Crypto Strength Matrix" to a cryptocurrency chart (e.g., BTC/USD or ETH/USD) on a daily or 4-hour timeframe for optimal results.
Interpret the Lines:
OTH (Altcoins excluding ETH and SOL): A value above 70 suggests strong momentum in smaller altcoins, while below 30 indicates weakness. Monitor for divergence with ETH and SOL.
ETH and SOL: High values (>70) signal potential overbought conditions for these assets, while low values (<30) may indicate oversold opportunities.
DXY: Rising above 70 may suggest a stronger dollar, potentially pressuring crypto prices, while below 30 could indicate a weakening dollar, favoring crypto.
DOM: A value above 70 reflects strong Bitcoin dominance, often leading to altcoin underperformance, while below 30 may signal altcoin season.
Combine with Price Action: Use the indicator alongside candlestick patterns or volume analysis to confirm trade signals.
Adjust RSI Length: The default RSI length is 14, but you can tweak this input in the indicator settings to suit your trading style (e.g., 7 for shorter-term, 21 for longer-term trends).
Monitor Trends: Look for crossovers between lines (e.g., OTH rising above DXY) or alignment with the 50 neutral line to gauge market shifts.
Tips
Timeframe Selection: Daily charts provide a broad market view, while 4-hour charts offer more frequent signals. Avoid very short timeframes (e.g., 5m) due to noise.
Contextual Awareness: Combine with macroeconomic news (e.g., U.S. dollar strength) and Bitcoin price movements for better decision-making.
Risk Management: Use the indicator as a supplementary tool, not a standalone signal, and always set stop-losses based on your risk tolerance.
This indicator is ideal for crypto traders seeking a comprehensive view of market dynamics without the complexity of multiple charts. Enjoy trading with the "Crypto Strength Matrix"!
% of stocks in spx above 200 ma— Simplified (30/70 levels)S5TH Breadth Suite — Simplified (30/70 Levels)
This indicator tracks the S&P 500 % of stocks above their 200-day moving average (S5TH), plotted on a 0–100 scale.
• Line Plot: Blue line shows the breadth percentage.
• Key Levels:
• 70 → Overbought zone
• 50 → Neutral midpoint
• 30 → Oversold zone
• Background Shading:
• Red tint = Oversold (<30)
• Green tint = Overbought (>70)
• Signals & Alerts:
• Circles mark midline crossovers.
• Arrows show exits from extreme zones (oversold/overbought).
• Alerts can be set for each condition.
✅ Clean design — no moving averages.
✅ Helps spot breadth extremes, reversals, and trend shifts.
✅ Works on any timeframe (default is chart TF).
Momentum Matrix SignalMomentum Matrix Signals is a real-time indicator that finds BUY/SELL signals using a VWMA trend, closing momentum, and a strength score. It allows for re-entries & exits. ⚠️ WARNING: This version repaints; signals can disappear before a bar closes.
Signal Scoring
A signal is only considered if it first meets two mandatory conditions: a momentum trend and VWMA trend alignment.
If these are met, the signal is then scored from 0 to 5 based on a checklist of five factors:
2-Bar Trend: Confirms initial momentum.
3-Bar Trend: Confirms sustained momentum.
VWMA Trend: Confirms main trend alignment.
Volume Pressure (OBV): Confirms money flow.
Volume Spike (RVOL): Confirms market interest.
A higher score indicates a stronger, higher-conviction signal.
Vietnamese: Swing Low Detection with SMA Bands & BackgroundThis script detects **swing lows** using a dynamic SMA-based logic and visually highlights them on the chart.
Features
Customizable Moving Averages: Supports multiple MA types (SMA, EMA, WMA, RMA, HMA, DEMA, TEMA, VWMA).
Swing Low Visualization: Identifies swing lows when price closes below the SMA of lows and exits once price trades above the SMA of highs.
Smart Rectangles: Marks detected swing lows with labeled boxes for clear visual reference.
Background Highlights**: Dynamically shades the chart background when price breaks below recent swing lows, helping traders spot potential breakdown zones.
Configurable Parameters: Period length, rectangle length, and MA source can all be tuned.
Use Cases
Spot breakdown/bearish continuation signals when price closes under recent lows.
Combine with higher timeframe trend analysis for confluence.
Notes
* This tool is designed for **visual analysis** and is not a standalone buy/sell signal.
* Works best when combined with broader trend analysis, support/resistance levels, and volume.
123Scalp-AHTDetector de patrones con confirmación para scalping.
Identifica Hammer/Shooting Star, Engulfing, Morning/Evening Star y Doji. Genera BUY/SELL con Entry/SL/TP (1R/1.5R/2R), opción 1-bar exit, filtro EMA, y alertas. Render Classic o Anchored (ABS) anclado al precio. No repinta tras la confirmación; pensado para intradía/scalping.
Scalp Pattern Signals — fast pattern/confirmation for intraday.
Detects Hammer/Shooting Star, Engulfing, Morning/Evening Star, and Doji. Produces BUY/SELL with Entry/SL/TP (1R/1.5R/2R), optional 1-bar exit, EMA trend filter, and alerts. Choose Classic or Anchored (ABS) rendering (anchored to price). No repaint after confirmation; built for scalping/intraday.
Ichimoku + SuperTrend + Oscillator + Divergence + SMC Lite//@version=5
indicator("Ichimoku + SuperTrend + Oscillator + Divergence + SMC Lite", overlay=true, max_labels_count=500, max_lines_count=500, max_boxes_count=500, max_bars_back=1000)
// ====================
// === CODE BLOCK 1: Ichimoku + SuperTrend + Oscillator Monitor + Divergence ===
// ====================
// --- User Inputs ---
lowerTF = input.timeframe("5", "Lower Timeframe (Ichimoku + SuperTrend)")
higherTF = input.timeframe("60", "Higher Timeframe (Tenkan/Kijun check)")
tenkanLength = input.int(9, "Tenkan-sen Length (Lower TF)")
kijunLength = input.int(26, "Kijun-sen Length (Lower TF)")
senkouSpanBLength = input.int(52, "Senkou Span B Length (Lower TF)")
displacement = input.int(26, "Displacement (Lower TF)")
showCloud = input.bool(true, "Show Kumo Cloud (Lower TF)")
buyColor = input.color(color.new(color.green, 0), "Buy Candle Color")
sellColor = input.color(color.new(color.red, 0), "Sell Candle Color")
crossCandleColor = input.color(color.new(color.yellow, 0), "Cross Candle Color")
bodyFilterColor = input.color(color.new(color.lime,0), "Body Filter Active Color")
htfCrossColor = input.color(color.new(color.orange,0), "HTF Cross Signal Color")
stopColor = input.color(color.new(color.red,0), "Stop Line Color")
targetColor = input.color(color.new(color.blue,0), "Target Line Color")
cooldownBars = input.int(5, "Cooldown Bars After Signal")
// --- Higher TF Ichimoku ---
tenkanLengthHTF = input.int(36, "Tenkan Length (Higher TF)")
kijunLengthHTF = input.int(103, "Kijun Length (Higher TF)")
showTenkanHTF = input.bool(true, "Show Tenkan (HTF)")
showKijunHTF = input.bool(true, "Show Kijun (HTF)")
tenkanHTFValue = request.security(syminfo.tickerid, higherTF, (ta.highest(high, tenkanLengthHTF)+ta.lowest(low, tenkanLengthHTF))/2)
kijunHTFValue = request.security(syminfo.tickerid, higherTF, (ta.highest(high, kijunLengthHTF)+ta.lowest(low, kijunLengthHTF))/2)
plot(showTenkanHTF ? tenkanHTFValue : na, color=color.blue, linewidth=2, title="Tenkan HTF")
plot(showKijunHTF ? kijunHTFValue : na, color=color.red, linewidth=2, title="Kijun HTF")
// --- Lower TF Ichimoku ---
tenkan = request.security(syminfo.tickerid, lowerTF, (ta.highest(high, tenkanLength) + ta.lowest(low, tenkanLength)) / 2)
kijun = request.security(syminfo.tickerid, lowerTF, (ta.highest(high, kijunLength) + ta.lowest(low, kijunLength)) / 2)
senkouA = request.security(syminfo.tickerid, lowerTF, (tenkan + kijun) / 2)
senkouB = request.security(syminfo.tickerid, lowerTF, (ta.highest(high, senkouSpanBLength) + ta.lowest(low, senkouSpanBLength)) / 2)
plot(tenkan, color=color.blue, title="Tenkan-sen (LTF)", linewidth=2)
plot(kijun, color=color.red, title="Kijun-sen (LTF)", linewidth=2)
sA = plot(senkouA , display=display.none)
sB = plot(senkouB , display=display.none)
cloudColor = showCloud ? (senkouA > senkouB ? color.new(color.green, 80) : color.new(color.red, 80)) : na
fill(sA, sB, color=cloudColor)
// --- Detect Crosses ---
crossUp = ta.crossover(tenkan, kijun)
crossDown = ta.crossunder(tenkan, kijun)
crossUpHTF = ta.crossover(tenkanHTFValue, kijunHTFValue)
crossDownHTF = ta.crossunder(tenkanHTFValue, kijunHTFValue)
candle2AboveCloud = close > math.max(senkouA , senkouB )
candle2BelowCloud = close < math.min(senkouA , senkouB )
// --- SuperTrend Lower TF ---
atrPeriodLTF = 12
multiplierLTF = 3.0
atrValueLTF = ta.atr(atrPeriodLTF)
upLTF = hl2 - multiplierLTF * atrValueLTF
dnLTF = hl2 + multiplierLTF * atrValueLTF
var int trendLTF = 1
trendLTF := trendLTF == -1 and close > dnLTF ? 1 : trendLTF == 1 and close < upLTF ? -1 : trendLTF
// --- SuperTrend Higher TF ---
useHTFST = input.bool(true, "Use HTF SuperTrend")
atrPeriodHTF = input.int(12, "HTF SuperTrend ATR")
multiplierHTF = input.float(3.0, "HTF SuperTrend Multiplier")
hl2HTF = request.security(syminfo.tickerid, higherTF, hl2)
atrHTF = request.security(syminfo.tickerid, higherTF, ta.atr(atrPeriodHTF))
upHTF = hl2HTF - multiplierHTF * atrHTF
dnHTF = hl2HTF + multiplierHTF * atrHTF
var int trendHTF = 1
trendHTF := trendHTF == -1 and close > dnHTF ? 1 : trendHTF == 1 and close < upHTF ? -1 : trendHTF
// --- Body Filter ---
useBodyFilter = input.bool(true, "Use Body Filter")
bodyMinPerc = input.float(20, "Min Body %")
bodyMaxPerc = input.float(100, "Max Body %")
bodyLen = math.abs(close - open)
candleLen = high - low
bodyPerc = (bodyLen / candleLen) * 100
bodyFilterPass = not useBodyFilter or (bodyPerc >= bodyMinPerc and bodyPerc <= bodyMaxPerc)
// --- Reward Filter ---
useReward = input.bool(true, "Use Reward 1:1 Filter")
stopLossPerc = input.float(1.5, "Stop Loss %")
reward1 = input.float(1.0, "Target 1 R/R")
reward2 = input.float(2.0, "Target 2 R/R")
reward3 = input.float(3.0, "Target 3 R/R")
rewardPass = not useReward or ((math.abs(close - tenkanHTFValue) * reward1) <= math.abs(kijunHTFValue - close))
// --- TSI Higher TF ---
tsiLong = input.int(25, "TSI Long")
tsiShort = input.int(13, "TSI Short")
tsiHTF = ta.tsi(request.security(syminfo.tickerid, higherTF, close), tsiLong, tsiShort)
// --- Lower TF Signals ---
buySignalLTF = (crossUp and candle2AboveCloud) and trendLTF == 1
sellSignalLTF = (crossDown and candle2BelowCloud) and trendLTF == -1
plotshape(crossUpHTF, title="HTF Buy Cross", location=location.belowbar, color=htfCrossColor, style=shape.triangleup, size=size.small)
plotshape(crossDownHTF, title="HTF Sell Cross", location=location.abovebar, color=htfCrossColor, style=shape.triangledown, size=size.small)
buyConfirmedRaw = (buySignalLTF and close > tenkanHTFValue and (not useHTFST or trendHTF==1)) and rewardPass and (tsiHTF > 0)
sellConfirmedRaw = (sellSignalLTF and close < tenkanHTFValue and (not useHTFST or trendHTF==-1)) and rewardPass and (tsiHTF < 0)
// --- Cooldown ---
var int barsSinceSignal = cooldownBars
barsSinceSignal += 1
buyConfirmed = buyConfirmedRaw and barsSinceSignal >= cooldownBars
sellConfirmed = sellConfirmedRaw and barsSinceSignal >= cooldownBars
if buyConfirmed or sellConfirmed
barsSinceSignal := 0
// --- Plot Final Signals ---
plotshape(buyConfirmed and bodyFilterPass, title="Buy Signal", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.small)
plotshape(sellConfirmed and bodyFilterPass, title="Sell Signal", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.small)
plotshape(buyConfirmed and not bodyFilterPass, title="Buy Signal (Filtered)", location=location.belowbar, color=bodyFilterColor, style=shape.triangleup, size=size.tiny)
plotshape(sellConfirmed and not bodyFilterPass, title="Sell Signal (Filtered)", location=location.abovebar, color=bodyFilterColor, style=shape.triangledown, size=size.tiny)
barcolor(crossUp or crossDown ? crossCandleColor : na)
barcolor(buyConfirmed and bodyFilterPass ? buyColor : sellConfirmed and bodyFilterPass ? sellColor : na)
// --- Stop & Targets ---
var float lastBuyPrice = na
var float lastSellPrice = na
var bool buyActive = false
var bool sellActive = false
f_drawLine(_price) =>
line.new(bar_index, _price, bar_index+3, _price, color=targetColor, width=2, style=line.style_dotted)
if buyConfirmed and not buyActive and not sellActive
buyActive := true
lastBuyPrice := close
line.new(bar_index, close*(1-stopLossPerc/100), bar_index+3, close*(1-stopLossPerc/100), color=stopColor, width=2, style=line.style_dotted)
f_drawLine(close*(1+reward1/100))
f_drawLine(close*(1+reward2/100))
f_drawLine(close*(1+reward3/100))
if buyActive
if low <= lastBuyPrice*(1-stopLossPerc/100) or high >= lastBuyPrice*(1+reward1/100)
buyActive := false
if sellConfirmed and not sellActive and not buyActive
sellActive := true
lastSellPrice := close
line.new(bar_index, close*(1+stopLossPerc/100), bar_index+3, close*(1+stopLossPerc/100), color=stopColor, width=2, style=line.style_dotted)
f_drawLine(close*(1-reward1/100))
f_drawLine(close*(1-reward2/100))
f_drawLine(close*(1-reward3/100))
if sellActive
if high >= lastSellPrice*(1+stopLossPerc/100) or low <= lastSellPrice*(1-reward1/100)
sellActive := false
// --- Oscillator Panel ---
showPanel = input.bool(true, "Show Oscillator Panel")
panelX = input.int(20, "Panel X Offset (Bars)")
panelY = input.int(50, "Panel Y Offset (Pixels)")
panelBgColor = input.color(color.new(color.black, 85), "Panel Background Color")
panelTextSize = input.string("normal", "Text Size", options= )
// MACD
macdFast = input.int(12)
macdSlow = input.int(26)
macdSignal= input.int(9)
= ta.macd(close, macdFast, macdSlow, macdSignal)
macdBull = macdLine > signalLine
// RSI
rsiLen = input.int(14)
rsiVal = ta.rsi(close, rsiLen)
rsiBull = rsiVal > 50
// TSI
tsiVal = ta.tsi(close, 25, 13)
tsiBull = tsiVal > 0
// Divergence detection (RSI, MACD, TSI)
leftBars = input.int(2)
rightBars = input.int(2)
rsiLow = ta.pivotlow(rsiVal, leftBars, rightBars)
rsiHigh = ta.pivothigh(rsiVal, leftBars, rightBars)
bullDivRSI = not na(rsiLow) and low < low and rsiVal > rsiVal
bearDivRSI = not na(rsiHigh) and high > high and rsiVal < rsiVal
macdLow = ta.pivotlow(macdLine, leftBars, rightBars)
macdHigh = ta.pivothigh(macdLine, leftBars, rightBars)
bullDivMACD = not na(macdLow) and low < low and macdLine > macdLine
bearDivMACD = not na(macdHigh) and high > high and macdLine < macdLine
tsiLow = ta.pivotlow(tsiVal, leftBars, rightBars)
tsiHigh = ta.pivothigh(tsiVal, leftBars, rightBars)
bullDivTSI = not na(tsiLow) and low < low and tsiVal > tsiVal
bearDivTSI = not na(tsiHigh) and high > high and tsiVal < tsiVal
// Plot divergence on chart
plotshape(bullDivRSI, style=shape.labelup, text="R d+", color=color.lime, textcolor=color.white, location=location.belowbar, size=size.tiny)
plotshape(bearDivRSI, style=shape.labeldown, text="R d-", color=color.red, textcolor=color.white, location=location.abovebar, size=size.tiny)
plotshape(bullDivMACD, style=shape.labelup, text="M d+", color=color.lime, textcolor=color.white, location=location.belowbar, size=size.tiny)
plotshape(bearDivMACD, style=shape.labeldown, text="M d-", color=color.red, textcolor=color.white, location=location.abovebar, size=size.tiny)
plotshape(bullDivTSI, style=shape.labelup, text="T d+", color=color.lime, textcolor=color.white, location=location.belowbar, size=size.tiny)
plotshape(bearDivTSI, style=shape.labeldown, text="T d-", color=color.red, textcolor=color.white, location=location.abovebar, size=size.tiny)
// Panel
var label panelLabel = label.new(bar_index + panelX, close, "", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=panelBgColor, size=panelTextSize)
if showPanel
label.set_xy(panelLabel, bar_index + panelX, close + panelY * syminfo.mintick)
label.set_text(panelLabel, "MACD: " + (macdBull ? "↑" : "↓") + (bullDivMACD ? " d+" : bearDivMACD ? " d-" : "") + " " +
"RSI : " + (rsiBull ? "↑" : "↓") + (bullDivRSI ? " d+" : bearDivRSI ? " d-" : "") + " " +
"TSI : " + (tsiBull ? "↑" : "↓") + (bullDivTSI ? " d+" : bearDivTSI ? " d-" : "") + " " +
"ST : " + (trendLTF==1 ? "↑" : "↓"))
label.set_textcolor(panelLabel, color.white)
// ====================
// === CODE BLOCK 2: FluidTrades - SMC Lite (Light) ===
// ====================
// === SETTINGS ===
swing_length = input.int(10, "Swing High/Low Length", minval=1, maxval=50)
history_keep = input.int(20, "History To Keep", minval=5, maxval=50)
box_width = input.float(2.5, "Supply/Demand Box Width", minval=1, maxval=10, step=0.5)
show_labels = input.bool(false, "Show Price Action Labels")
supply_color = input.color(color.new(#EDEDED,70), "Supply Color")
supply_outline = input.color(color.new(color.white,75), "Supply Outline")
demand_color = input.color(color.new(#00FFFF,70), "Demand Color")
demand_outline = input.color(color.new(color.white,75), "Demand Outline")
bos_color = input.color(color.white, "BOS Label Color")
poi_color = input.color(color.white, "POI Label Color")
label_color = input.color(color.black, "Swing Label Color")
// === FUNCTIONS ===
f_add_pop(arr, val) =>
array.unshift(arr, val)
array.pop(arr)
f_draw_swing_label(values, swing_type) =>
var string txt = na
if swing_type == 1
txt := array.get(values,0) >= array.get(values,1) ? "HH" : "LH"
label.new(bar_index - swing_length, array.get(values,0), txt, style=label.style_label_down, textcolor=label_color, color=color.new(label_color,100), size=size.tiny)
else
txt := array.get(values,0) >= array.get(values,1) ? "HL" : "LL"
label.new(bar_index - swing_length, array.get(values,0), txt, style=label.style_label_up, textcolor=label_color, color=color.new(label_color,100), size=size.tiny)
f_check_overlap(new_poi, box_arr, atr) =>
ok = true
for i=0 to array.size(box_arr)-1
b = array.get(box_arr,i)
top = box.get_top(b)
bot = box.get_bottom(b)
mid = (top+bot)/2
threshold = atr*2
if new_poi >= mid - threshold and new_poi <= mid + threshold
ok := false
break
ok
f_create_box(vals, bn_arr, box_arr, label_arr, type_box, atr) =>
atr_buf = atr*(box_width/10)
left = array.get(bn_arr,0)
right = bar_index
var float top=0.0
var float bottom=0.0
var float poi=0.0
if type_box==1
top := array.get(vals,0)
bottom := top - atr_buf
else
bottom := array.get(vals,0)
top := bottom + atr_buf
poi := (top+bottom)/2
if f_check_overlap(poi, box_arr, atr)
box.delete(array.get(box_arr,array.size(box_arr)-1))
f_add_pop(box_arr, box.new(left, top, right, bottom, border_color=type_box==1?supply_outline:demand_outline,
bgcolor=type_box==1?supply_color:demand_color, extend=extend.right, text=type_box==1?"SUPPLY":"DEMAND",
text_halign=text.align_center, text_valign=text.align_center, text_color=poi_color, text_size=size.small, xloc=xloc.bar_index))
box.delete(array.get(label_arr,array.size(label_arr)-1))
f_add_pop(label_arr, box.new(left, poi, right, poi, border_color=color.new(poi_color,90),
bgcolor=color.new(poi_color,90), extend=extend.right, text="POI", text_halign=text.align_left, text_valign=text.align_center, text_color=poi_color, text_size=size.small, xloc=xloc.bar_index))
f_to_bos(box_arr, bos_arr, label_arr, type_box) =>
for i=0 to array.size(box_arr)-1
b = array.get(box_arr,i)
lvl = type_box==1? box.get_top(b) : box.get_bottom(b)
cond = type_box==1? close>=lvl : close<=lvl
if cond
cbox = box.copy(b)
f_add_pop(bos_arr, cbox)
mid = (box.get_top(b)+box.get_bottom(b))/2
box.set_top(cbox, mid)
box.set_bottom(cbox, mid)
box.set_extend(cbox, extend.none)
box.set_right(cbox, bar_index)
box.set_text(cbox, "BOS")
box.set_text_color(cbox, bos_color)
box.set_text_size(cbox, size.small)
box.set_text_halign(cbox, text.align_center)
box.set_text_valign(cbox, text.align_center)
box.delete(b)
box.delete(array.get(label_arr,i))
f_extend(box_arr) =>
for i=0 to array.size(box_arr)-1
box.set_right(array.get(box_arr,i), bar_index+100)
// === CALCULATIONS ===
atr = ta.atr(50)
swing_high = ta.pivothigh(high, swing_length, swing_length)
swing_low = ta.pivotlow(low, swing_length, swing_length)
var swing_high_vals = array.new_float(5,0.0)
var swing_low_vals = array.new_float(5,0.0)
var swing_high_bn = array.new_int(5,0)
var swing_low_bn = array.new_int(5,0)
var supply_boxes = array.new_box(history_keep, na)
var demand_boxes = array.new_box(history_keep, na)
var supply_poi = array.new_box(history_keep, na)
var demand_poi = array.new_box(history_keep, na)
var bos_supply = array.new_box(5, na)
var bos_demand = array.new_box(5, na)
// NEW SWING HIGH
if not na(swing_high)
f_add_pop(swing_high_vals, swing_high)
f_add_pop(swing_high_bn, bar_index )
if show_labels
f_draw_swing_label(swing_high_vals,1)
f_create_box(swing_high_vals, swing_high_bn, supply_boxes, supply_poi, 1, atr)
// NEW SWING LOW
if not na(swing_low)
f_add_pop(swing_low_vals, swing_low)
f_add_pop(swing_low_bn, bar_index )
if show_labels
f_draw_swing_label(swing_low_vals,-1)
f_create_box(swing_low_vals, swing_low_bn, demand_boxes, demand_poi, -1, atr)
f_to_bos(supply_boxes, bos_supply, supply_poi, 1)
f_to_bos(demand_boxes, bos_demand, demand_poi, -1)
f_extend(supply_boxes)
f_extend(demand_boxes)
//@version=6
length = input.int(9, minval=1)
src = input(close, title="Source")
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
dema = 2 * e1 - e2
plot(dema, "DEMA", color=#43A047)
Ichimoku + SuperTrend + Oscillator + Divergence + SMC Lite//@version=5
indicator("Ichimoku + SuperTrend + Oscillator + Divergence + SMC Lite", overlay=true, max_labels_count=500, max_lines_count=500, max_boxes_count=500, max_bars_back=1000)
// ====================
// === CODE BLOCK 1: Ichimoku + SuperTrend + Oscillator Monitor + Divergence ===
// ====================
// --- User Inputs ---
lowerTF = input.timeframe("5", "Lower Timeframe (Ichimoku + SuperTrend)")
higherTF = input.timeframe("60", "Higher Timeframe (Tenkan/Kijun check)")
tenkanLength = input.int(9, "Tenkan-sen Length (Lower TF)")
kijunLength = input.int(26, "Kijun-sen Length (Lower TF)")
senkouSpanBLength = input.int(52, "Senkou Span B Length (Lower TF)")
displacement = input.int(26, "Displacement (Lower TF)")
showCloud = input.bool(true, "Show Kumo Cloud (Lower TF)")
buyColor = input.color(color.new(color.green, 0), "Buy Candle Color")
sellColor = input.color(color.new(color.red, 0), "Sell Candle Color")
crossCandleColor = input.color(color.new(color.yellow, 0), "Cross Candle Color")
bodyFilterColor = input.color(color.new(color.lime,0), "Body Filter Active Color")
htfCrossColor = input.color(color.new(color.orange,0), "HTF Cross Signal Color")
stopColor = input.color(color.new(color.red,0), "Stop Line Color")
targetColor = input.color(color.new(color.blue,0), "Target Line Color")
cooldownBars = input.int(5, "Cooldown Bars After Signal")
// --- Higher TF Ichimoku ---
tenkanLengthHTF = input.int(36, "Tenkan Length (Higher TF)")
kijunLengthHTF = input.int(103, "Kijun Length (Higher TF)")
showTenkanHTF = input.bool(true, "Show Tenkan (HTF)")
showKijunHTF = input.bool(true, "Show Kijun (HTF)")
tenkanHTFValue = request.security(syminfo.tickerid, higherTF, (ta.highest(high, tenkanLengthHTF)+ta.lowest(low, tenkanLengthHTF))/2)
kijunHTFValue = request.security(syminfo.tickerid, higherTF, (ta.highest(high, kijunLengthHTF)+ta.lowest(low, kijunLengthHTF))/2)
plot(showTenkanHTF ? tenkanHTFValue : na, color=color.blue, linewidth=2, title="Tenkan HTF")
plot(showKijunHTF ? kijunHTFValue : na, color=color.red, linewidth=2, title="Kijun HTF")
// --- Lower TF Ichimoku ---
tenkan = request.security(syminfo.tickerid, lowerTF, (ta.highest(high, tenkanLength) + ta.lowest(low, tenkanLength)) / 2)
kijun = request.security(syminfo.tickerid, lowerTF, (ta.highest(high, kijunLength) + ta.lowest(low, kijunLength)) / 2)
senkouA = request.security(syminfo.tickerid, lowerTF, (tenkan + kijun) / 2)
senkouB = request.security(syminfo.tickerid, lowerTF, (ta.highest(high, senkouSpanBLength) + ta.lowest(low, senkouSpanBLength)) / 2)
plot(tenkan, color=color.blue, title="Tenkan-sen (LTF)", linewidth=2)
plot(kijun, color=color.red, title="Kijun-sen (LTF)", linewidth=2)
sA = plot(senkouA , display=display.none)
sB = plot(senkouB , display=display.none)
cloudColor = showCloud ? (senkouA > senkouB ? color.new(color.green, 80) : color.new(color.red, 80)) : na
fill(sA, sB, color=cloudColor)
// --- Detect Crosses ---
crossUp = ta.crossover(tenkan, kijun)
crossDown = ta.crossunder(tenkan, kijun)
crossUpHTF = ta.crossover(tenkanHTFValue, kijunHTFValue)
crossDownHTF = ta.crossunder(tenkanHTFValue, kijunHTFValue)
candle2AboveCloud = close > math.max(senkouA , senkouB )
candle2BelowCloud = close < math.min(senkouA , senkouB )
// --- SuperTrend Lower TF ---
atrPeriodLTF = 12
multiplierLTF = 3.0
atrValueLTF = ta.atr(atrPeriodLTF)
upLTF = hl2 - multiplierLTF * atrValueLTF
dnLTF = hl2 + multiplierLTF * atrValueLTF
var int trendLTF = 1
trendLTF := trendLTF == -1 and close > dnLTF ? 1 : trendLTF == 1 and close < upLTF ? -1 : trendLTF
// --- SuperTrend Higher TF ---
useHTFST = input.bool(true, "Use HTF SuperTrend")
atrPeriodHTF = input.int(12, "HTF SuperTrend ATR")
multiplierHTF = input.float(3.0, "HTF SuperTrend Multiplier")
hl2HTF = request.security(syminfo.tickerid, higherTF, hl2)
atrHTF = request.security(syminfo.tickerid, higherTF, ta.atr(atrPeriodHTF))
upHTF = hl2HTF - multiplierHTF * atrHTF
dnHTF = hl2HTF + multiplierHTF * atrHTF
var int trendHTF = 1
trendHTF := trendHTF == -1 and close > dnHTF ? 1 : trendHTF == 1 and close < upHTF ? -1 : trendHTF
// --- Body Filter ---
useBodyFilter = input.bool(true, "Use Body Filter")
bodyMinPerc = input.float(20, "Min Body %")
bodyMaxPerc = input.float(100, "Max Body %")
bodyLen = math.abs(close - open)
candleLen = high - low
bodyPerc = (bodyLen / candleLen) * 100
bodyFilterPass = not useBodyFilter or (bodyPerc >= bodyMinPerc and bodyPerc <= bodyMaxPerc)
// --- Reward Filter ---
useReward = input.bool(true, "Use Reward 1:1 Filter")
stopLossPerc = input.float(1.5, "Stop Loss %")
reward1 = input.float(1.0, "Target 1 R/R")
reward2 = input.float(2.0, "Target 2 R/R")
reward3 = input.float(3.0, "Target 3 R/R")
rewardPass = not useReward or ((math.abs(close - tenkanHTFValue) * reward1) <= math.abs(kijunHTFValue - close))
// --- TSI Higher TF ---
tsiLong = input.int(25, "TSI Long")
tsiShort = input.int(13, "TSI Short")
tsiHTF = ta.tsi(request.security(syminfo.tickerid, higherTF, close), tsiLong, tsiShort)
// --- Lower TF Signals ---
buySignalLTF = (crossUp and candle2AboveCloud) and trendLTF == 1
sellSignalLTF = (crossDown and candle2BelowCloud) and trendLTF == -1
plotshape(crossUpHTF, title="HTF Buy Cross", location=location.belowbar, color=htfCrossColor, style=shape.triangleup, size=size.small)
plotshape(crossDownHTF, title="HTF Sell Cross", location=location.abovebar, color=htfCrossColor, style=shape.triangledown, size=size.small)
buyConfirmedRaw = (buySignalLTF and close > tenkanHTFValue and (not useHTFST or trendHTF==1)) and rewardPass and (tsiHTF > 0)
sellConfirmedRaw = (sellSignalLTF and close < tenkanHTFValue and (not useHTFST or trendHTF==-1)) and rewardPass and (tsiHTF < 0)
// --- Cooldown ---
var int barsSinceSignal = cooldownBars
barsSinceSignal += 1
buyConfirmed = buyConfirmedRaw and barsSinceSignal >= cooldownBars
sellConfirmed = sellConfirmedRaw and barsSinceSignal >= cooldownBars
if buyConfirmed or sellConfirmed
barsSinceSignal := 0
// --- Plot Final Signals ---
plotshape(buyConfirmed and bodyFilterPass, title="Buy Signal", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.small)
plotshape(sellConfirmed and bodyFilterPass, title="Sell Signal", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.small)
plotshape(buyConfirmed and not bodyFilterPass, title="Buy Signal (Filtered)", location=location.belowbar, color=bodyFilterColor, style=shape.triangleup, size=size.tiny)
plotshape(sellConfirmed and not bodyFilterPass, title="Sell Signal (Filtered)", location=location.abovebar, color=bodyFilterColor, style=shape.triangledown, size=size.tiny)
barcolor(crossUp or crossDown ? crossCandleColor : na)
barcolor(buyConfirmed and bodyFilterPass ? buyColor : sellConfirmed and bodyFilterPass ? sellColor : na)
// --- Stop & Targets ---
var float lastBuyPrice = na
var float lastSellPrice = na
var bool buyActive = false
var bool sellActive = false
f_drawLine(_price) =>
line.new(bar_index, _price, bar_index+3, _price, color=targetColor, width=2, style=line.style_dotted)
if buyConfirmed and not buyActive and not sellActive
buyActive := true
lastBuyPrice := close
line.new(bar_index, close*(1-stopLossPerc/100), bar_index+3, close*(1-stopLossPerc/100), color=stopColor, width=2, style=line.style_dotted)
f_drawLine(close*(1+reward1/100))
f_drawLine(close*(1+reward2/100))
f_drawLine(close*(1+reward3/100))
if buyActive
if low <= lastBuyPrice*(1-stopLossPerc/100) or high >= lastBuyPrice*(1+reward1/100)
buyActive := false
if sellConfirmed and not sellActive and not buyActive
sellActive := true
lastSellPrice := close
line.new(bar_index, close*(1+stopLossPerc/100), bar_index+3, close*(1+stopLossPerc/100), color=stopColor, width=2, style=line.style_dotted)
f_drawLine(close*(1-reward1/100))
f_drawLine(close*(1-reward2/100))
f_drawLine(close*(1-reward3/100))
if sellActive
if high >= lastSellPrice*(1+stopLossPerc/100) or low <= lastSellPrice*(1-reward1/100)
sellActive := false
// --- Oscillator Panel ---
showPanel = input.bool(true, "Show Oscillator Panel")
panelX = input.int(20, "Panel X Offset (Bars)")
panelY = input.int(50, "Panel Y Offset (Pixels)")
panelBgColor = input.color(color.new(color.black, 85), "Panel Background Color")
panelTextSize = input.string("normal", "Text Size", options= )
// MACD
macdFast = input.int(12)
macdSlow = input.int(26)
macdSignal= input.int(9)
= ta.macd(close, macdFast, macdSlow, macdSignal)
macdBull = macdLine > signalLine
// RSI
rsiLen = input.int(14)
rsiVal = ta.rsi(close, rsiLen)
rsiBull = rsiVal > 50
// TSI
tsiVal = ta.tsi(close, 25, 13)
tsiBull = tsiVal > 0
// Divergence detection (RSI, MACD, TSI)
leftBars = input.int(2)
rightBars = input.int(2)
rsiLow = ta.pivotlow(rsiVal, leftBars, rightBars)
rsiHigh = ta.pivothigh(rsiVal, leftBars, rightBars)
bullDivRSI = not na(rsiLow) and low < low and rsiVal > rsiVal
bearDivRSI = not na(rsiHigh) and high > high and rsiVal < rsiVal
macdLow = ta.pivotlow(macdLine, leftBars, rightBars)
macdHigh = ta.pivothigh(macdLine, leftBars, rightBars)
bullDivMACD = not na(macdLow) and low < low and macdLine > macdLine
bearDivMACD = not na(macdHigh) and high > high and macdLine < macdLine
tsiLow = ta.pivotlow(tsiVal, leftBars, rightBars)
tsiHigh = ta.pivothigh(tsiVal, leftBars, rightBars)
bullDivTSI = not na(tsiLow) and low < low and tsiVal > tsiVal
bearDivTSI = not na(tsiHigh) and high > high and tsiVal < tsiVal
// Plot divergence on chart
plotshape(bullDivRSI, style=shape.labelup, text="R d+", color=color.lime, textcolor=color.white, location=location.belowbar, size=size.tiny)
plotshape(bearDivRSI, style=shape.labeldown, text="R d-", color=color.red, textcolor=color.white, location=location.abovebar, size=size.tiny)
plotshape(bullDivMACD, style=shape.labelup, text="M d+", color=color.lime, textcolor=color.white, location=location.belowbar, size=size.tiny)
plotshape(bearDivMACD, style=shape.labeldown, text="M d-", color=color.red, textcolor=color.white, location=location.abovebar, size=size.tiny)
plotshape(bullDivTSI, style=shape.labelup, text="T d+", color=color.lime, textcolor=color.white, location=location.belowbar, size=size.tiny)
plotshape(bearDivTSI, style=shape.labeldown, text="T d-", color=color.red, textcolor=color.white, location=location.abovebar, size=size.tiny)
// Panel
var label panelLabel = label.new(bar_index + panelX, close, "", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=panelBgColor, size=panelTextSize)
if showPanel
label.set_xy(panelLabel, bar_index + panelX, close + panelY * syminfo.mintick)
label.set_text(panelLabel, "MACD: " + (macdBull ? "↑" : "↓") + (bullDivMACD ? " d+" : bearDivMACD ? " d-" : "") + " " +
"RSI : " + (rsiBull ? "↑" : "↓") + (bullDivRSI ? " d+" : bearDivRSI ? " d-" : "") + " " +
"TSI : " + (tsiBull ? "↑" : "↓") + (bullDivTSI ? " d+" : bearDivTSI ? " d-" : "") + " " +
"ST : " + (trendLTF==1 ? "↑" : "↓"))
label.set_textcolor(panelLabel, color.white)
// ====================
// === CODE BLOCK 2: FluidTrades - SMC Lite (Light) ===
// ====================
// === SETTINGS ===
swing_length = input.int(10, "Swing High/Low Length", minval=1, maxval=50)
history_keep = input.int(20, "History To Keep", minval=5, maxval=50)
box_width = input.float(2.5, "Supply/Demand Box Width", minval=1, maxval=10, step=0.5)
show_labels = input.bool(false, "Show Price Action Labels")
supply_color = input.color(color.new(#EDEDED,70), "Supply Color")
supply_outline = input.color(color.new(color.white,75), "Supply Outline")
demand_color = input.color(color.new(#00FFFF,70), "Demand Color")
demand_outline = input.color(color.new(color.white,75), "Demand Outline")
bos_color = input.color(color.white, "BOS Label Color")
poi_color = input.color(color.white, "POI Label Color")
label_color = input.color(color.black, "Swing Label Color")
// === FUNCTIONS ===
f_add_pop(arr, val) =>
array.unshift(arr, val)
array.pop(arr)
f_draw_swing_label(values, swing_type) =>
var string txt = na
if swing_type == 1
txt := array.get(values,0) >= array.get(values,1) ? "HH" : "LH"
label.new(bar_index - swing_length, array.get(values,0), txt, style=label.style_label_down, textcolor=label_color, color=color.new(label_color,100), size=size.tiny)
else
txt := array.get(values,0) >= array.get(values,1) ? "HL" : "LL"
label.new(bar_index - swing_length, array.get(values,0), txt, style=label.style_label_up, textcolor=label_color, color=color.new(label_color,100), size=size.tiny)
f_check_overlap(new_poi, box_arr, atr) =>
ok = true
for i=0 to array.size(box_arr)-1
b = array.get(box_arr,i)
top = box.get_top(b)
bot = box.get_bottom(b)
mid = (top+bot)/2
threshold = atr*2
if new_poi >= mid - threshold and new_poi <= mid + threshold
ok := false
break
ok
f_create_box(vals, bn_arr, box_arr, label_arr, type_box, atr) =>
atr_buf = atr*(box_width/10)
left = array.get(bn_arr,0)
right = bar_index
var float top=0.0
var float bottom=0.0
var float poi=0.0
if type_box==1
top := array.get(vals,0)
bottom := top - atr_buf
else
bottom := array.get(vals,0)
top := bottom + atr_buf
poi := (top+bottom)/2
if f_check_overlap(poi, box_arr, atr)
box.delete(array.get(box_arr,array.size(box_arr)-1))
f_add_pop(box_arr, box.new(left, top, right, bottom, border_color=type_box==1?supply_outline:demand_outline,
bgcolor=type_box==1?supply_color:demand_color, extend=extend.right, text=type_box==1?"SUPPLY":"DEMAND",
text_halign=text.align_center, text_valign=text.align_center, text_color=poi_color, text_size=size.small, xloc=xloc.bar_index))
box.delete(array.get(label_arr,array.size(label_arr)-1))
f_add_pop(label_arr, box.new(left, poi, right, poi, border_color=color.new(poi_color,90),
bgcolor=color.new(poi_color,90), extend=extend.right, text="POI", text_halign=text.align_left, text_valign=text.align_center, text_color=poi_color, text_size=size.small, xloc=xloc.bar_index))
f_to_bos(box_arr, bos_arr, label_arr, type_box) =>
for i=0 to array.size(box_arr)-1
b = array.get(box_arr,i)
lvl = type_box==1? box.get_top(b) : box.get_bottom(b)
cond = type_box==1? close>=lvl : close<=lvl
if cond
cbox = box.copy(b)
f_add_pop(bos_arr, cbox)
mid = (box.get_top(b)+box.get_bottom(b))/2
box.set_top(cbox, mid)
box.set_bottom(cbox, mid)
box.set_extend(cbox, extend.none)
box.set_right(cbox, bar_index)
box.set_text(cbox, "BOS")
box.set_text_color(cbox, bos_color)
box.set_text_size(cbox, size.small)
box.set_text_halign(cbox, text.align_center)
box.set_text_valign(cbox, text.align_center)
box.delete(b)
box.delete(array.get(label_arr,i))
f_extend(box_arr) =>
for i=0 to array.size(box_arr)-1
box.set_right(array.get(box_arr,i), bar_index+100)
// === CALCULATIONS ===
atr = ta.atr(50)
swing_high = ta.pivothigh(high, swing_length, swing_length)
swing_low = ta.pivotlow(low, swing_length, swing_length)
var swing_high_vals = array.new_float(5,0.0)
var swing_low_vals = array.new_float(5,0.0)
var swing_high_bn = array.new_int(5,0)
var swing_low_bn = array.new_int(5,0)
var supply_boxes = array.new_box(history_keep, na)
var demand_boxes = array.new_box(history_keep, na)
var supply_poi = array.new_box(history_keep, na)
var demand_poi = array.new_box(history_keep, na)
var bos_supply = array.new_box(5, na)
var bos_demand = array.new_box(5, na)
// NEW SWING HIGH
if not na(swing_high)
f_add_pop(swing_high_vals, swing_high)
f_add_pop(swing_high_bn, bar_index )
if show_labels
f_draw_swing_label(swing_high_vals,1)
f_create_box(swing_high_vals, swing_high_bn, supply_boxes, supply_poi, 1, atr)
// NEW SWING LOW
if not na(swing_low)
f_add_pop(swing_low_vals, swing_low)
f_add_pop(swing_low_bn, bar_index )
if show_labels
f_draw_swing_label(swing_low_vals,-1)
f_create_box(swing_low_vals, swing_low_bn, demand_boxes, demand_poi, -1, atr)
f_to_bos(supply_boxes, bos_supply, supply_poi, 1)
f_to_bos(demand_boxes, bos_demand, demand_poi, -1)
f_extend(supply_boxes)
f_extend(demand_boxes)
//@version=6
length = input.int(9, minval=1)
src = input(close, title="Source")
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
dema = 2 * e1 - e2
plot(dema, "DEMA", color=#43A047)
WAE SHK Teyla 3MDesigned to detect high-pressure market moments, where momentum and volume converge to trigger explosive moves. Ideal as an entry trigger in scalping strategies, especially when paired with STC and ST-MA.
Futures Rotation Strategy - Overlay (Tables & Signals)This strategy focuses on the laggards and leaders of the market indices and does some weird stuff and determines which to long or short.