OPEN-SOURCE SCRIPT

Indicator ***TuYa*** V8.2 – HH/HL MTF + Peak Mid Zone

67
Indicator TuYa V8.0 – HH/HL MTF + Peak Mid Zone

TuYa V8.0 combines multi-timeframe market structure with a Peak Reaction midline to create clean, rule-based reversal and trend entries – designed primarily for 1-minute execution with 1-hour bias.

🧠 Core Concept

This indicator fuses three ideas:

HTF Peak Reaction Midline (1H)

Uses a Peak Reaction style logic on the higher timeframe (HTF, default: 1H).

Identifies a reaction high and reaction low, then calculates their midpoint → the Peak Mid Zone.

This midline acts as a dynamic sentiment divider (above = premium / below = discount).

Multi-Timeframe HH/HL/LH/LL Structure

HTF structure (1H): detects HH, HL, LH, LL using pivot highs/lows.

LTF structure (1m): detects HH, HL, LH, LL on the execution timeframe (chart TF, intended for 1m).

HTF → LTF Confirmation Window

After a 1H structure event (HH, HL, LL, LH), the indicator opens a confirmation window of up to N LTF candles (default: 10 x 1m bars).

Within that window, the required 1m structure event must occur to confirm an entry.

🎯 Signal Logic

All entries are generated on the LTF (e.g. 1m chart), using HTF (e.g. 1H) bias + Peak Mid Zone:

1️⃣ Price ABOVE Peak Mid (Bullish premium zone)

Reversal SELL

HTF: HH (Higher High)

Within N 1m bars: LTF HH

→ SELL signal (fading HTF strength near premium)

Trend/Bullish BUY

HTF: HL (Higher Low)

Within N 1m bars: LTF LL

→ BUY signal (buying dips in an uptrend above midline)

2️⃣ Price BELOW Peak Mid (Bearish discount zone)

Reversal BUY

HTF: LL (Lower Low)

Within N 1m bars: LTF LL

→ BUY signal (catching potential reversal from discount)

Trend/Bearish SELL

HTF: LH (Lower High)

Within N 1m bars: LTF HH

→ SELL signal (shorting strength in a downtrend below midline)

Signals are plotted as small BUY/SELL triangles on the chart and exposed via alert conditions.

🧾 Filters & Options
⏳ HTF → LTF Delay Window

Input: “Max 1m bars after HTF trigger” (default: 10)

After a 1H HH/HL/LL/LH event, the indicator waits up to N LTF candles for the matching 1m structure pattern.

If no match occurs within the window, no signal is generated.

📉 RSI No-Trade Zone (HTF)

Toggle: Use RSI no-trade zone

Inputs:

RSI Length (HTF)

No-trade lower bound (default 45)

No-trade upper bound (default 65)

If HTF RSI is inside the defined band (e.g. 45–65), signals are blocked (no-trade regime), helping to avoid noisy mid-range conditions.

You can turn this filter ON/OFF and adjust the band dynamically.

🧱 5m OB / Direction Filter (Optional)

Toggle: Use 5m OB direction filter

Timeframe: Configurable (default: 5m).

Uses a simple directional proxy on the OB timeframe:

For BUY signals → require a bullish candle on OB timeframe.

For SELL signals → require a bearish candle on OB timeframe.

When enabled, this adds an extra layer of confluence by aligning entries with the short-term directional context.

⚙️ Key Inputs (Summary)

Timeframes

HTF (Peak Reaction & Structure): default 60 (1H)

Peak Reaction

Lookback bars (HTF)

ATR multiplier for zones

Show/Hide Peak Mid line

Structure

Pivot left/right bars (for HH/HL/LH/LL swings)

Toggle structure labels (HTF & LTF)

Confirmation

Max LTF bars after HTF trigger (default 10, fully configurable)

RSI Filter

Use filter (on/off)

RSI length

No-trade range (low/high)

5m OB Filter

Use filter (on/off)

OB timeframe (default 5m)

📡 Alerts & Automation

The script includes alertconditions for both BUY and SELL signals, with JSON-formatted alert messages suitable for routing to external bridges (e.g. bots, MT5/MT4, n8n, etc.).

Each alert includes:

Symbol

Side (BUY / SELL)

Price / Entry

SL & TP placeholders (from hidden plots, ready to be wired to your own logic)

Time

Performance tag

CommentCode (for strategy/type tagging on the receiver side)

You can attach these alerts to a webhook and let your execution engine handle SL/TP and order management.

📌 How to Use

Attach the indicator to a 1-minute chart.

Set HTF timeframe to 60 (or your preferred higher timeframe).

Optionally enable:

RSI regime filter

5m OB direction filter

Watch for:

Price relative to the Peak Mid line

BUY/SELL triangles that respect HTF structure + LTF confirmation + filters.

For automation, create alerts using the built-in conditions and your preferred JSON alert template.

⚠️ Disclaimer

This tool is for educational and informational purposes only.
It is not financial advice and does not guarantee profits. Always test thoroughly in replay / paper trading before using with live funds, and trade at your own risk.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน