MSSM – Multi-Session Structural Map (Precision Sweeps)MSSM – Multi-Session Structural Map (Precision Sweeps)
This indicator provides a structured view of the market based on four key components:
1). Previous session levels
2). Confirmed fractal swing points
3). Volume pocket highlights
4). Non-repainting precision liquidity sweep markers
It is designed to help analyze how price interacts with important reference areas and structural points. This tool does not generate signals or predictions. All information is visual and educational only.
HOW THE INDICATOR WORKS
PREVIOUS SESSION LEVELS
The script plots the previous session’s High, Low, and Mid. These levels help observe how the current session behaves around the prior day’s range. They act as reference areas only.
FRACTAL SWING MAP (NON-REPAINTING)
Confirmed fractals are used to mark historical swing highs and swing lows. Since fractals confirm after a certain number of bars, the swings do not repaint once formed. These swings provide a clearer view of market structure.
VOLUME POCKETS
The indicator highlights areas where volume expands relative to a rolling volume average. These regions show increased participation or activity. The highlights are informational and do not imply direction.
PRECISION LIQUIDITY SWEEPS (NON-REPAINTING)
A sweep is tagged only when:
• Price trades beyond a confirmed swing high or swing low
• Price closes back inside the previous swing level
• A wick rejection occurs
• Volume expands relative to a recent rolling average
These markers simply show where price interacted with liquidity around prior structural levels. They do not indicate a trading signal or bias.
HOW TO ADD THE INDICATOR
Open the Pine Editor in TradingView
Search the indicator name and add to favorites.
Click “Add to chart”
Adjust settings as needed (fractals, sweeps, volume pockets, or session levels)
HOW TO READ AND USE THE INDICATOR
SESSION LEVELS
Observe whether price respects, rejects, compresses around, or expands beyond the previous session high, low, or midpoint. These are observational reference levels only.
FRACTALS
Fractal highs and lows help visualize structural turning points. They provide a clearer picture of where liquidity may rest above or below past swing levels.
VOLUME POCKETS
When volume expands compared to the recent average, the candle is shaded. These areas may show increased participation, but no directional meaning is implied.
PRECISION SWEEPS
Sweeps highlight when price reaches beyond a prior confirmed swing level and then rejects that area with displacement. These markers identify interactions with liquidity, but they are not signals and do not forecast future outcomes.
CUSTOMIZATION OPTIONS
Users can adjust:
• Session level visibility
• Fractal sensitivity
• Volume pocket threshold
• Sweep sensitivity and visibility
• Transparency and styling
This makes the tool flexible across different symbols and timeframes.
IMPORTANT NOTES AND POLICY COMPLIANCE
• The indicator does not provide buy or sell signals
• The indicator does not predict price or direction
• All plotted elements are based on past price behavior
• All components are informational only
• Users should perform their own analysis and risk evaluation
• Past behavior does not guarantee future performance
SUMMARY
MSSM provides a structured view of price by combining previous session levels, confirmed swing structure, volume expansion zones, and non-repainting sweep identification. Its purpose is to assist traders in visually analyzing market structure while staying fully aligned with TradingView’s House Rules and content policies.
Indicadores e estratégias
LionheartLionheart is an extremely successful trading strategy involving the 5, 13 and 55 EMA. It is designed to be the MOST successful when used on the daily timeframe and only after the daily candle has closed upon firing of the trade signal.
Manual Max Pain LevelsThis indicator lets you manually input Max Pain levels from Coinglass and plot them directly on your chart. Purple color chosen as a tribute to MartyParty.
Features
• Manual input for Long/Short Max Pain
• Clean horizontal levels with labels
• Fast, lightweight, chart-only tool
Copy the Max Pain prices from Coinglass and paste them into the inputs.
Kalman Ema Crosses - [JTCAPITAL]Kalman EMA Crosses - is a modified way to use Kalman Filters applied on Exponential Moving Averages (EMA Crosses) for Trend-Following.
Credits for the kalman function itself goes to @BackQuant
The Kalman filter is a recursive smoothing algorithm that reduces noise from raw price or indicator data, and in this script it is applied both directly to price and on top of EMA calculations. The goal is to create cleaner, more reliable crossover signals between two EMAs that are less prone to false triggers caused by volatility or market noise.
The indicator works by calculating in the following steps:
Source Selection
The script starts by selecting the price input (default is Close, but can be adjusted). This chosen source is the foundation for all further smoothing and EMA calculations.
Kalman Filtering on Price
Depending on user settings, the selected source is passed through one of two independent Kalman filters. The filter takes into account process noise (representing expected market randomness) and measurement noise (representing uncertainty in the price data). The Kalman filter outputs a smoothed version of price that minimizes noise and preserves underlying trend structure.
EMA Calculation
Two exponential moving averages (EMA 1 and EMA 2) are then computed on the Kalman-smoothed price. The lengths of these EMAs are fully customizable (default 15 and 25).
Kalman Filtering on EMA Values
Instead of directly using raw EMA curves, the script applies a second layer of Kalman filtering to the EMA values themselves. This step significantly reduces whipsaw behavior, creating smoother crossovers that emphasize real momentum shifts rather than temporary volatility spikes.
Trend Detection via EMA Crossovers
-A bullish trend is detected when EMA 1 (fast) crosses above EMA 2 (slow).
-A bearish trend is detected when EMA 1 crosses below EMA 2.
The detected trend state is stored and used to dynamically color the plots.
Visual Representation
Both EMAs are plotted on the chart. Their colors shift to blue during bullish phases and purple during bearish phases. The area between the two EMAs is filled with a shaded region to clearly highlight trending conditions.
Buy and Sell Conditions:
-Buy Condition: When the Kalman-smoothed EMA 1 crosses above the Kalman-smoothed EMA 2, a bullish crossover is confirmed.
-Sell Condition: When EMA 1 crosses below EMA 2, a bearish crossover is confirmed.
Users may enhance the robustness of these signals by adjusting process noise, measurement noise, or EMA lengths. Lower measurement noise values make the filter react faster (but potentially noisier), while higher values make it smoother (but slower).
Features and Parameters:
-Source: Selectable price input (Close, Open, High, Low, etc.).
-EMA 1 Length: Defines the fast EMA period.
-EMA 2 Length: Defines the slow EMA period.
-Process Noise: Controls how much randomness the Kalman filter assumes in price dynamics.
-Measurement Noise: Controls how much uncertainty is assumed in raw input data.
-Kalman Usage: Option to apply Kalman filtering either before EMA calculation (on price) or after (on EMA values).
Specifications:
Kalman Filter
The Kalman filter is an optimal recursive algorithm that estimates the state of a system from noisy measurements. In trading, it is used to smooth prices or indicator values. By balancing process noise (expected volatility) with measurement noise (data uncertainty), it generates a smoothed signal that reacts adaptively to market conditions.
Exponential Moving Average (EMA)
An EMA is a weighted moving average that emphasizes recent data more heavily than older data. This makes it more responsive than a simple moving average (SMA). EMAs are widely used to identify trends and momentum shifts.
EMA Crossovers
The crossing of a fast EMA above a slow EMA suggests bullish momentum, while the opposite suggests bearish momentum. This is a cornerstone technique in trend-following systems.
Dual Kalman Filtering
Applying Kalman both to raw price and to the EMAs themselves reduces whipsaws further. It creates crossover signals that are not only smoothed but also validated across two levels of noise reduction. This significantly enhances signal reliability compared to traditional EMA crossovers.
Process Noise
Represents the filter’s assumption about how much the underlying market can randomly change between steps. Higher values make the filter adapt faster to sudden changes, while lower values make it more stable.
Measurement Noise
Represents uncertainty in price data. A higher measurement noise value means the filter trusts the model more than the observed data, leading to smoother results. A lower value makes the filter more reactive to observed price fluctuations.
Trend Coloring & Fill
The use of dynamic colors and filled regions provides immediate visual recognition of trend states, helping traders act faster and with greater clarity.
Enjoy!
PDH/PDL Sweep & Rejection - sudoPDH/PDL Sweep + Rejection
This indicator identifies classic liquidity sweeps of the previous day's high or low, then confirms whether price rejected that level with force. It is built to highlight moments when the market takes liquidity and immediately snaps back in the opposite direction, a behavior often linked to failed breakouts, engineered stops, or clean reversals. The tool marks these events directly on the chart so you can see them without manually watching the daily levels.
What it detects
The indicator focuses on two events:
PDH sweep and rejection
Price breaks above the previous day's high, overshoots the level by a meaningful amount, and then closes back below the high.
PDL sweep and rejection
Price breaks below the previous day's low, overshoots, and then closes back above the low.
These are structural liquidity events, not random wicks. The script checks for enough overshoot and strong bar range to confirm it was a genuine stop grab rather than noise.
How it works
The indicator evaluates each bar using the following logic:
1. Previous day levels
It pulls yesterday's high and low directly from the daily timeframe. These act as the PDH and PDL reference points for intraday trading.
2. Overshoot measurement
After breaking the level, price must push far enough beyond it to qualify as a sweep. Instead of using arbitrary pips, the required overshoot is scaled relative to ATR. This keeps the logic stable across different assets and volatility conditions.
3. Range confirmation
The bar must be larger than normal compared to ATR. This ensures the sweep happened with momentum and not because of small, choppy price movement.
4. Rejection close
A valid signal only prints if price closes back inside the previous day's range.
For a PDH sweep, the bar must close below PDH.
For a PDL sweep, the bar must close above PDL.
This confirms a failed breakout and a rejection.
What gets placed on the chart
Red downward triangle above the bar: Previous Day High sweep and rejection
Lime upward triangle below the bar: Previous Day Low sweep and rejection
The markers appear exactly on the bar where the sweep and rejection occurred.
How traders can use this
Identify potential reversals
Sweeps often occur when algorithms target liquidity pools. When followed by a strong rejection, the market may be preparing for a reversal or rotation.
Avoid chasing breakouts
A clear sweep warns that a breakout attempt failed. This can prevent traders from entering at the worst possible location.
Time entries at extremes
The markers help you see where the market grabbed stops and immediately turned. These areas can become high quality entry zones in both trend continuation and countertrend setups.
Support liquidity based models
The indicator aligns naturally with trading frameworks that consider liquidity, displacement, failed breaks, and microstructure shifts.
Add confidence to confluence-based setups
Combine sweeps with displacement, FVGs, or higher timeframe levels to refine entry timing.
Why this indicator is helpful
It automates a pattern that traders often identify manually. Sweeps are easy to miss in fast markets, and this tool eliminates the need to constantly monitor daily levels. By marking only the events that show overshoot plus rejection plus significant range, it filters out the weak or false signals and leaves only meaningful liquidity events.
MTF 3-Step Assistant v5 (KO, RR, FVG, DayType)kljghfjzktg,hmnf k,zujfthgmturzhdfgbv. ehztgrfsdbtzerdhfg
Displacement Pulse Markers - sudoThis indicator is designed to highlight sudden and meaningful bursts of price movement. These bursts are called displacement pulses. A pulse appears when price expands with force, closes near the extreme of its own bar, and breaks through a recent structural level. The indicator places small circles above or below the candle to signal these moments so that traders can quickly spot abnormal movement and potential shifts in market intent.
How it works
The indicator evaluates each bar for three conditions:
Range expansion relative to volatility
The bar must be larger than normal. It compares the bar range to ATR and requires that range to exceed a multiple of ATR. When this condition is met, the bar is considered a large or forceful bar.
Close location within the bar
The bar has to close near its own high or low. A close near the top suggests strong buying force. A close near the bottom suggests strong selling force. The user can adjust what percentage qualifies as near the top or bottom.
Break of recent structure
The bar must break a recent pivot level. For bullish pulses, the high of the bar must exceed the highest high of the past N bars. For bearish pulses, the low must break the lowest low of the past N bars. This confirms that the move did not merely expand but actually displaced prior structure.
When all conditions align
A bullish displacement pulse is marked with a small aqua circle below the bar.
A bearish displacement pulse is marked with a fuchsia circle above the bar.
The result is a clean on chart visualization of where price produced meaningful displacement.
How traders can use this
Spot abnormal momentum
Pulses can highlight areas where price behaves with more force than usual. These events often appear around news, liquidity sweeps, or algorithmic shifts.
Identify possible regime changes
A pulse that breaks structure while closing near the extreme may signal a transition from a ranging environment to a trending one. It does not predict direction but flags where displacement actually occurred.
Support narrative building
When combined with levels, zones, or other frameworks, pulses can confirm whether the market had enough strength to break through an area with conviction.
Filter trades or refine entries
Some traders may choose to trade in the direction of recent pulses during trending conditions. Others may only enter a trade after a pulse confirms that the market has shifted away from compression.
Track where the market is imbalanced
A pulse visually marks whether buyers or sellers were able to generate strong initiative movement. These points often become useful reference zones for continuation or rejection analysis.
Why this indicator is useful
It reduces complex logic into simple visual markers. Instead of scanning bar by bar for structural breaks, volatility expansions, and close strength, the indicator does this automatically and highlights only the bars that meet all criteria. This keeps the chart clean while still providing precision about where displacement actually occurred.
EMA 9/20/200This indicator plots three Exponential Moving Averages (EMAs) on the chart: a short-term 9-period EMA in red, a medium-term 20-period EMA in orange, and a long-term 200-period EMA in blue. It's useful for identifying trends, crossovers, and potential support/resistance levels. Overlay it on any timeframe for stocks, forex, or crypto.
RSI buy signal 1D#rsibuysignal on daily -for swing strategy.
buy near close and trail stop with ema10 or low of previous bar
Daily EMA 20/50/100/200 MTF + ContextDaily EMA 20/50/100/200 MTF + Context is a multi–timeframe trend and structure tool that projects classic higher-timeframe EMAs (20, 50, 100, 200) onto any lower timeframe and adds rich contextual analysis.
The goal of the script is not just to draw moving averages, but to explain what their relative position means in terms of trend strength, direction, and market phase.
Matt's Multi-Timeframe MACD Direction AlertThe indicator monitors the direction of the Moving Average Convergence Divergence (MACD) lines on four specific timeframes: 1-hour, 15-minute, 5-minute, and 1-minute.
It only generates a signal when the MACD in all four timeframes is trending in the same direction (either all are bullish, or all are bearish). This alignment suggests a strong, synchronized market momentum from short-term scalping views up to immediate-term swing views.
Key Features:
Multi-Timeframe Confirmation: Uses TradingView's request.security() function to fetch data from different timeframes (1h, 15m, 5m, 1m), preventing the need to manually switch charts.
Visual Dashboard: A dashboard table is displayed on your chart, providing an immediate visual status (Bullish/Bearish/Neutral) for each of the four timeframes.
On-Chart Signals: The indicator plots visual shapes (green triangles for bullish alignment, red triangles for bearish alignment) directly on the sub-chart when the condition is met.
Custom Alert Integration: It includes a built-in alertcondition() function, allowing traders to set up real-time, hands-free notifications whenever a synchronized trading opportunity arises.
This tool helps filter out noise and potential false signals that might appear on a single timeframe, focusing instead on robust signals confirmed by a consensus of time perspectives.
TSD Trend DotsThis script is a modified version of the original “Trend Strength Directional (TSD)” by Trebor_Namor. All core logic, idea, and inspiration come from Trebor_Namor’s work – this version simply adds a clearer alert framework.
TSD combines a wave-based momentum filter with a custom MFI to show the strength and direction of money flow. The “black” wave tracks price momentum, while the MFI color shows whether capital is flowing into (green) or out of (red) the market.
In this edition, the dots are separated into explicit signals:
Green Dot – bullish cross (momentum turning up, potential buy/entry area).
Red Dot – bearish cross (momentum turning down, potential take-profit/exit area).
Separate alertcondition events are provided for Green and Red dots so traders can set individual alerts for long and short bias, while still respecting the original TSD concept. This script is for educational and research purposes only – always combine it with your own analysis and risk management.
Dual MACD Pro – eSignal Match (ta.macd v2)Similar to my other indicator however this is gives u trend up or down ( lines moving together ) and shaded whether green line above red or vice versa
NEXFEL - Adaptive MACD Flow PRONEXFEL – Adaptive MACD Flow PRO is a next-generation market analysis engine built on an enhanced Adaptive MACD core.
It combines R² correlation, multi-timeframe sentiment, volatility modeling, trend structure and regime detection to deliver highly refined BUY/SELL signals directly on the chart.
With dynamic target projection, confidence scoring, flow-based candle coloring and a real-time analytics panel, this tool provides a clear and intelligent read of momentum shifts before they fully develop — ideal for precision scalping and high-performance decision-making.
KWP EMA ribbonEMA
ma8 = ta.sma(close,9)
ma21 = ta.sma(close,21)
ma200 = ta.sma(close,200)
ema74 = ta.ema(close,74)
ma610 = ta.sma(close,610)
ema987 = ta.ema(close,987)
ema34 = ta.ema(close,34)
ema89 = ta.ema(close,89)
v = ta.vwap(close)
plot(ma8, "ma9", color=color.aqua, linewidth=2)
plot(ma21, "ma21", color=color.fuchsia, linewidth=2)
plot(ma200, "ma200", color=color.rgb(202, 14, 14), linewidth=1)
plot(ema74, "ema74", color=color.maroon, linewidth=4)
plot(ma610, "ma610", color=color.blue, linewidth=3)
plot(ema987, "ema987", color=color.green, linewidth=2)
plot(ema34, "ema34", color=color.yellow, linewidth=4)
plot(ema89, "ema89", color=color.rgb(0, 166, 28), linewidth=2)
plot(v, "VWAP", color=color.orange, linewidth=4)
VWAP mit StdDev + 0,25 Bändern (dezent)This indicator displays the Volume Weighted Average Price (VWAP) together with standard deviation bands and additional ±0.25 offset bands. VWAP serves as the central reference line, while the deviation bands show how far price typically moves away from VWAP.
1 standard deviation (±1σ) covers roughly 68% of all price movements around VWAP.
2 standard deviations (±2σ) cover about 95% of price movements.
3 standard deviations (±3σ) cover approximately 99.7% of price movements.
Around VWAP and the first deviation level, extra ±0.25 offset bands are added to highlight tighter ranges. These shaded zones help traders identify areas of expected price concentration, potential support and resistance, and volatility boundaries.
Purpose: The tool provides a statistical framework for intraday trading. VWAP shows the average traded price weighted by volume, while the deviation bands indicate probability zones where price is most likely to remain.
Sessions + VWAP + MA [Kilesa]This tool visualizes global trading sessions directly on the chart by plotting real-time session ranges, VWAP levels, and customizable moving averages. It highlights session highs and lows using dynamic range boxes with selectable border styles, and allows traders to track trends with both standard and fixed-timeframe MAs. Designed for clarity and precision, the indicator helps identify liquidity zones, volatility windows, session-to-session structure, and intraday directional bias across any timeframe.
Momentum Structural AnalysisMomentum Structural Analysis (MSA‑style Oscillator)
This indicator implements a simple, MSA‑style momentum oscillator that measures how far price has moved above or below its own long‑term trend on the active timeframe, expressed in percentage terms. Instead of looking at raw price, it "oscillates" price around a timeframe‑appropriate simple moving average (SMA) and plots the percentage distance from that SMA as an orange line around a zero baseline. Zero means price is exactly at its structural trend; positive values mean price is extended above trend; negative values mean it is trading below trend.
The script automatically selects the SMA length based on the chart timeframe:
On daily charts it uses the configurable Daily SMA Length (default 252 trading days, roughly 1 year).
On weekly charts it uses Weekly SMA Length (default 208 weeks).
On monthly charts it uses Monthly SMA Length (default 120 months).
This approach is inspired by the ideas behind Momentum Structural Analysis (MSA), which studies where a market trades relative to long‑term moving averages and then treats the momentum line (the oscillator) as the primary object of analysis. The goal is to highlight structural overbought/oversold conditions and regime changes that are often clearer on momentum than on the raw price chart.
--------------------------------------------------
What the script computes and how it works
For each bar, the indicator:
Chooses an SMA length based on the current timeframe (daily/weekly/monthly).
Calculates the SMA of the close.
Computes the percentage distance:
\text{Diff %} = \frac{\text{Close} - \text{SMA}}{\text{SMA}} \times 100
Plots this Diff % as an orange line, with a dashed horizontal zero line as the base.
This produces a momentum oscillator that oscillates around zero and reflects the "structural" position of price versus its own long‑term mean.
--------------------------------------------------
How to use it on index charts (e.g., NIFTY50)
On indices like NIFTY50, use the indicator to see how stretched the index is versus its structural trend.
Typical uses:
Identify extremes: a). Historically high positive readings can signal euphoric, late‑stage conditions where risk is elevated. b). Deep negative readings can highlight panic/capitulation zones where downside may be exhausted.
Draw structural levels: a). Mark horizontal bands on the oscillator where past turns have occurred (e.g., +15%, −10%, etc. specific to NIFTY50). b). Watch how price behaves when the oscillator revisits these zones: repeated rejections can validate them as structural bounds; clean breaks can indicate a change of regime.
This is not a buy/sell signal generator by itself; it is a framework to understand where the index sits within its long‑term momentum structure and to support risk‑management decisions.
--------------------------------------------------
How to use it on ratio charts
Apply the same indicator to ratio symbols such as NIFTY50/GOLD, BANKNIFTY/NIFTY50, sector vs index, or any spread you plot as a ratio.
On a ratio chart:
The oscillator now measures relative momentum: how far that ratio is above or below its own long‑term mean.
High positive readings = strong outperformance of the numerator vs the denominator (e.g., equities strongly outperforming gold).
Deep negative readings = strong underperformance (e.g., equities structurally lagging gold).
This is very much in the spirit of MSA’s work on spreads between asset classes: it helps visualize major rotations (equities → gold, financials → commodities, etc.) and whether a relative‑performance trend is stretched, reverting, or breaking into a new phase.
--------------------------------------------------
Using multiple timeframes for better decisions
You can stack information across timeframes to get a more robust view:
Monthly : a). Use monthly charts to see secular/structural phases. b). Long multi‑year stretches above or below zero, and large bases or trendline breaks on the monthly oscillator, can mark major bull or bear cycles and big rotations between asset classes.
Weekly : a). Use weekly charts for the primary trend. b). Weekly structures (multi‑month highs/lows, channels, or trendlines on the oscillator) are useful for medium‑term positioning and for confirming or rejecting signals seen on the monthly view.
Daily : a). Use daily charts mainly for timing entries/exits once the higher‑timeframe direction is clear. b). Short‑term extremes on the daily oscillator that align with the larger weekly/monthly structure can offer better‑timed opportunities, while signals that contradict higher‑timeframe momentum are more likely to be noise.
--------------------------------------------------
Static 5 EMA Pack by LMA simple display of 5 ems's using 8,21,50,55,200 as the lengths for the ema's.
90% Buying Power Position Size Helper90% Buying Power Position Size Helper — Script Description
This tool calculates a recommended share size based on your available buying power and the current market price. TradingView does not provide access to live broker balances, so this script allows you to manually enter your current buying power and instantly see how many shares you can buy using a chosen percentage of it (default: 90%).
How It Works
• Enter your Buying Power ($)
• Choose the Percent to Use (e.g., 90%).
• The script divides the selected portion of your buying power by the current price of the symbol.
• A small display in the chart corner shows the recommended number of shares to buy.
Formula
shares = floor((buying_power * percent_to_use / 100) / price)
What It’s For
• Day traders who size positions based on account buying power
• Traders who want a quick way to calculate share size per trade
• Anyone who sizes entries using a fixed percentage of their account
What It Doesn’t Do
Due to TradingView limitations, the script cannot:
• Read your live buying power or broker balance
• Auto-fill orders or submit trades
• Retrieve real account data from your broker
You simply update the buying power input whenever your account changes, and the script does the rest.
Why It’s Useful
• Keeps you consistent with position sizing
• Reduces manual math during fast trading
• Prevents oversizing or undersizing trades
• Helps maintain discipline and risk control
Wick Size Percentage (%) IndicatorA lightweight utility script that measures the wick size of every bar in percentages. It helps identify significant rejection blocks and volatility spikes by displaying the exact % value above and below each candle. Perfect for ICT concepts and precise risk management.
This indicator is designed for price action traders who need precise measurements of market volatility and rejection. It automatically calculates and displays the size of both the upper and lower wicks of a candle as a percentage relative to the open price.
Key Features:
Dual Measurement: Separately calculates the upper wick (high to body) and lower wick (body to low).
Percentage Based: Values are shown in percentages (%) rather than price points, making it easier to compare volatility across different assets (Crypto, Forex, Stocks).
Dynamic Labels: Visual labels appear above and below the candles for quick reading.
Fully Customizable: Users can adjust the decimal precision (e.g., for low timeframe scalping), change text size, and toggle visibility to keep the chart clean.
Data Window Support: Values are also visible in the side Data Window for detailed analysis without clutter.
2 MACD VISUEL — 4H / 1H / 15M + CONFIRMATION 5M//@version=6
indicator("MTF MACD VISUEL — 4H / 1H / 15M + CONFIRMATION 5M", overlay=true, max_labels_count=500)
// ─────────────────────────────
// Fonction MACD Histogram
// ─────────────────────────────
f_macd(src) =>
fast = ta.ema(src, 12)
slow = ta.ema(src, 26)
macd = fast - slow
signal = ta.ema(macd, 9)
hist = macd - signal
hist
// ─────────────────────────────
// MTF MACD HISTOGRAM
// ─────────────────────────────
h4 = request.security(syminfo.tickerid, "240", f_macd(close))
h1 = request.security(syminfo.tickerid, "60", f_macd(close))
h15 = request.security(syminfo.tickerid, "15", f_macd(close))
h5 = request.security(syminfo.tickerid, "5", f_macd(close))
// Signes
s4 = h4 > 0 ? 1 : h4 < 0 ? -1 : 0
s1 = h1 > 0 ? 1 : h1 < 0 ? -1 : 0
s15 = h15 > 0 ? 1 : h15 < 0 ? -1 : 0
s5 = h5 > 0 ? 1 : h5 < 0 ? -1 : 0
// Conditions
three_same = (s4 == s1) and (s1 == s15) and (s4 != 0)
five_same = three_same and (s5 == s4)
// BUY / SELL logiques
isBUY = five_same and s4 == 1
isSELL = five_same and s4 == -1
// ─────────────────────────────
// DASHBOARD VISUEL (en haut du graphique)
// ─────────────────────────────
var table dash = table.new(position.top_right, 4, 2, border_color=color.black)
table.cell(dash, 0, 0, "4H", bgcolor = s4 == 1 ? color.green : s4 == -1 ? color.red : color.gray)
table.cell(dash, 1, 0, "1H", bgcolor = s1 == 1 ? color.green : s1 == -1 ? color.red : color.gray)
table.cell(dash, 2, 0, "15M", bgcolor = s15 == 1 ? color.green : s15 == -1 ? color.red : color.gray)
table.cell(dash, 3, 0, "5M", bgcolor = s5 == 1 ? color.green : s5 == -1 ? color.red : color.gray)
table.cell(dash, 0, 1, s4 == 1 ? "↑" : s4 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 1, 1, s1 == 1 ? "↑" : s1 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 2, 1, s15 == 1 ? "↑" : s15 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 3, 1, s5 == 1 ? "↑" : s5 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
// ─────────────────────────────
// SIGNES VISUELS SUR LE GRAPHIQUE
// ─────────────────────────────
plotshape(isBUY, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.large, text="BUY")
plotshape(isSELL, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.large, text="SELL")
// Histogramme du MACD 5M en couleur tendance
plot(h5, title="MACD Hist 5M", color = h5 >= 0 ? color.green : color.red, style=plot.style_columns)
// ─────────────────────────────
// Alerte Webhook (message constant OBLIGATOIRE)
// ─────────────────────────────
alertcondition(isBUY, title="Signal BUY Confirmé", message="MTF_MACD_BUY")
alertcondition(isSELL, title="Signal SELL Confirmé", message="MTF_MACD_SELL")
1MTF MACD Alignement XAUUSD - Webhook v6//@version=6
indicator("MTF MACD Alignement XAUUSD - Webhook v6", overlay=false)
// ===== Paramètres utilisateur =====
fast_len = input.int(12, "Fast Length")
slow_len = input.int(26, "Slow Length")
signal_len = input.int(9, "Signal Length")
repl_secret = input.string(title="Webhook secret (doit matcher WEBHOOK_SECRET)", defval="Covid-19@2020")
// ===== Fonction MACD histogramme =====
f_macd_hist(src) =>
macd = ta.ema(src, fast_len) - ta.ema(src, slow_len)
signal = ta.ema(macd, signal_len)
hist = macd - signal
hist
// ===== Récupération multi-timeframe =====
hist4h = request.security(syminfo.tickerid, "240", f_macd_hist(close), lookahead=barmerge.lookahead_off)
hist1h = request.security(syminfo.tickerid, "60", f_macd_hist(close), lookahead=barmerge.lookahead_off)
hist15m = request.security(syminfo.tickerid, "15", f_macd_hist(close), lookahead=barmerge.lookahead_off)
hist5m = request.security(syminfo.tickerid, "5", f_macd_hist(close), lookahead=barmerge.lookahead_off)
// ===== Signes de MACD =====
s4 = hist4h > 0 ? 1 : (hist4h < 0 ? -1 : 0)
s1 = hist1h > 0 ? 1 : (hist1h < 0 ? -1 : 0)
s15 = hist15m > 0 ? 1 : (hist15m < 0 ? -1 : 0)
s5 = hist5m > 0 ? 1 : (hist5m < 0 ? -1 : 0)
// ===== Vérification alignement TF supérieurs =====
three_same = (s4 != 0) and (s4 == s1) and (s1 == s15)
// ===== Confirmation 5M =====
five_in_same = three_same and (s5 == s4)
// ===== Préparation du JSON pour webhook =====
signal_type = s4 == 1 ? "BUY" : (s4 == -1 ? "SELL" : "NEUTRAL")
alert_json = '{"secret":"'+repl_secret+'","symbol":"'+syminfo.ticker+'","signal":"'+signal_type+'","time":"'+str.tostring(time, "yyyy-MM-dd HH:mm:ss")+'","aligned": }'
// ===== Alertcondition compilable =====
// v6 n’accepte pas message dynamique, donc on met un message fixe
alertcondition(five_in_same and ta.change(five_in_same), title="MACD Align + 5M confirm", message="MACD alignement détecté")
// ===== Affichage optionnel des histogrammes =====
plot(hist4h, title="hist 4H", color=color.new(color.green, 0), linewidth=1)
plot(hist1h, title="hist 1H", color=color.new(color.blue, 0), linewidth=1)
plot(hist15m, title="hist 15M", color=color.new(color.orange, 0), linewidth=1)
plot(hist5m, title="hist 5M", color=color.new(color.purple, 0), linewidth=1)






















