PROTECTED SOURCE SCRIPT
TSD with 1H Trend & MFI Area

script is a custom trading indicator designed for intraday momentum and trend analysis, primarily using the WaveTrend oscillator, Money Flow Index (MFI), and a higher timeframe (HTF) filter (like 1-hour trend) to provide Buy/Sell signals with visual and background cues.
Here's a structured breakdown:
🔍 Purpose
This indicator helps traders identify potential trade entries and exits based on:
Momentum crossovers (WaveTrend)
Money inflows/outflows (MFI)
Higher-timeframe trend confirmation (like 1H)
Overbought/Oversold levels
🧠 Core Components
1. WaveTrend Oscillator (WT)
Calculates WT1 and WT2 using hlc3, ema, and sma.
WT1 is the fast line, WT2 is the smoothed signal.
Crossovers between WT1 and WT2 indicate entry/exit signals.
2. Money Flow Index (MFI)
Custom MFI calculation using volume and price change logic.
Optional smoothing using ta.sma.
Transformed for alignment with WT's range.
Positive MFI = bullish pressure; Negative = bearish.
3. Higher Timeframe Trend Filter (1H)
Applies WT and MFI logic to the 1-hour chart using request.security.
Ensures signals align with larger trend context (prevents false entries).
Categorizes trends as:
Strong Bullish: WT1 > WT2 + MFI > 10 + WT1–WT2 > threshold
Strong Bearish: WT1 < WT2 + MFI < -10 + WT1–WT2 > threshold
Bullish / Bearish: Looser conditions
📈 Signals
🔼 Buy Signal:
pinescript
Copy
Edit
ta.crossover(wt1, wt2) and bullish_htf
WT crossover up on current timeframe + HTF is bullish
🔽 Sell Signal:
pinescript
Copy
Edit
ta.crossunder(wt1, wt2) and bearish_htf
❌ Exit Signals:
crossunder(wt1, wt2) → Exit Buy
crossover(wt1, wt2) → Exit Sell
🎨 Visuals
Area plots for WT and MFI.
Buy/Sell markers with color-coded triangles.
Background color changes based on HTF trend (green/red/neutral).
Horizontal lines for Overbought/Oversold thresholds.
Circle dots for OB/OS violations.
📦 Configurable Inputs
Lengths (n1, n2) for WT
Overbought/oversold levels
Smoothing toggle for MFI
Colors, opacities, and marker styles
🛠️ Design Highlights
Non-overlay (separate pane) — not plotted on price chart
Multiple visual cues for clarity: labels, background, shading
Scales properly with invisible padding lines
Good modular structure: you can plug in additional conditions or convert to a strategy
🚩 Limitations
Doesn't show Support/Resistance levels (unless added)
Can give late entries in fast markets due to smoothing
Not overlaid on chart (may be hard to associate signals with candles)
No alerts defined (easy to add with alertcondition())
🔁 Use Cases
Great for 15–30 min intraday trading
Especially useful for momentum pullback or trend continuation entries
Combine with price action/S&R zones for higher conviction
Here's a structured breakdown:
🔍 Purpose
This indicator helps traders identify potential trade entries and exits based on:
Momentum crossovers (WaveTrend)
Money inflows/outflows (MFI)
Higher-timeframe trend confirmation (like 1H)
Overbought/Oversold levels
🧠 Core Components
1. WaveTrend Oscillator (WT)
Calculates WT1 and WT2 using hlc3, ema, and sma.
WT1 is the fast line, WT2 is the smoothed signal.
Crossovers between WT1 and WT2 indicate entry/exit signals.
2. Money Flow Index (MFI)
Custom MFI calculation using volume and price change logic.
Optional smoothing using ta.sma.
Transformed for alignment with WT's range.
Positive MFI = bullish pressure; Negative = bearish.
3. Higher Timeframe Trend Filter (1H)
Applies WT and MFI logic to the 1-hour chart using request.security.
Ensures signals align with larger trend context (prevents false entries).
Categorizes trends as:
Strong Bullish: WT1 > WT2 + MFI > 10 + WT1–WT2 > threshold
Strong Bearish: WT1 < WT2 + MFI < -10 + WT1–WT2 > threshold
Bullish / Bearish: Looser conditions
📈 Signals
🔼 Buy Signal:
pinescript
Copy
Edit
ta.crossover(wt1, wt2) and bullish_htf
WT crossover up on current timeframe + HTF is bullish
🔽 Sell Signal:
pinescript
Copy
Edit
ta.crossunder(wt1, wt2) and bearish_htf
❌ Exit Signals:
crossunder(wt1, wt2) → Exit Buy
crossover(wt1, wt2) → Exit Sell
🎨 Visuals
Area plots for WT and MFI.
Buy/Sell markers with color-coded triangles.
Background color changes based on HTF trend (green/red/neutral).
Horizontal lines for Overbought/Oversold thresholds.
Circle dots for OB/OS violations.
📦 Configurable Inputs
Lengths (n1, n2) for WT
Overbought/oversold levels
Smoothing toggle for MFI
Colors, opacities, and marker styles
🛠️ Design Highlights
Non-overlay (separate pane) — not plotted on price chart
Multiple visual cues for clarity: labels, background, shading
Scales properly with invisible padding lines
Good modular structure: you can plug in additional conditions or convert to a strategy
🚩 Limitations
Doesn't show Support/Resistance levels (unless added)
Can give late entries in fast markets due to smoothing
Not overlaid on chart (may be hard to associate signals with candles)
No alerts defined (easy to add with alertcondition())
🔁 Use Cases
Great for 15–30 min intraday trading
Especially useful for momentum pullback or trend continuation entries
Combine with price action/S&R zones for higher conviction
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.