PROTECTED SOURCE SCRIPT

The Gain Anchor - Long/Short Signals

44
The Gain Anchor – Long/Short Signals (WunderTrading Bot Ready)
Dual Anchored VWAP System Powered by Overbought & Oversold Signals

A high-precision AVWAP and Z-Score system designed to generate Long/Buy and Short/Sell signals.
This indicator is ideal for swing trades and can be used as a standard signal indicator or seamlessly integrated for automated trading with WunderTrading bots.

--------------------------------------------------
Inputs
--------------------------------------------------
• Master Symbol: Sets the symbol used to track market trend. When disabled, the chart’s symbol is used to track its own trend.
• Rolling AVWAP Length: Defines the AVWAP calculation lookback (the bar where calculation starts).
• Minimum Investment Amount ($): Minimum is $6. For WunderTrading, it should not be less than $12.
• Minimum Profit Target ($): Ensures returns are higher than the defined minimum profit.
• Z-Score Lookback: Sets the lookback length for the Z-Score calculation window.
• Z-Score Threshold: Defines the base threshold. (The code auto-adjusts thresholds as more data is processed.)
• Long/Short Strings Input: Enter the alert messages you want to receive. For WunderTrading bots, input your Long Entry, Long Exit, Short Entry, and Short Exit codes.
• Show Other Lines: Displays Rolling AVWAP plot, Take Profit, and Stop Loss lines.
• Table Position: Choose the dashboard placement on your chart.

--------------------------------------------------
Core Logic
--------------------------------------------------
• Z-Score: Detects price deviation from its mean. When the price overextends based on the lookback, AVWAPs are reset.
• Resetting AVWAP 1 / Fast AVWAP (White Line): Uses a weaker threshold.
• Resetting AVWAP 2 / Slow AVWAP (Blue Line): Uses stronger thresholds, confirming and filtering weaker crosses.
• When AVWAP 2 resets, it signals a possible trend change and may generate new signals.
• If AVWAP 2 detects excessively frequent trend changes (high volatility), new signals are automatically disabled.
• Stop Loss and Take Profit are derived from bar distance relative to the lowest AVWAP (longs) or highest AVWAP (shorts).
If this exceeds your minimum investment, the system auto-adjusts the size.
If stop loss is not positioned beyond the AVWAPs, no signal is generated.

--------------------------------------------------
Trade Signals Logic
--------------------------------------------------
The indicator’s signal mechanism is designed to prevent overtrading during
high volatility.

- Signals are disabled when a sudden surge in volatility is detected.
- Only one signal is generated per legitimate trend change.
- Example:
• When the trend switches to bullish, only one Long signal is given.
• Once that Long position is closed (profit or loss), no new signal will be issued until another valid trend change occurs.
• The same logic applies to bearish/Short positions.

This ensures that signals remain clean, infrequent, and aligned with real trend shifts rather than noise.

--------------------------------------------------
Take Profit & Stop Loss
--------------------------------------------------
• Take Profit has two levels:
1. First Level: Triggered when the trend changes and price is below the first TP level.
2. Second Level: Triggered if the price surges into the second TP level.
The position is closed on whichever condition is met first.

• On Scale:
- Take Profit (Gray Line): Rolling take profit value.
- Stop Loss (Maroon Line): Rolling stop loss value, auto-calculated as half the minimum profit.
- Gray Stop Loss and Take Profit: Rolling Stop Loss and Take Profit purpose is mainly for manual trading but when they are both gray it is not ideal to look for an entry.

• On Chart:
- Take Profit: Lime (Longs), Fuchsia (Shorts). Fixed from signal start until triggered.
- Stop Loss: Yellow (Longs), Maroon (Shorts). Fixed from signal start until triggered.
- You have to activate "Show Other Lines" in Input to see them

--------------------------------------------------
Signal Markers
--------------------------------------------------
• 👆 = Long Entry
• Green Dot = Long Exit (TP/SL)
• 👇 = Short Entry
• Fuchsia Dot = Short Exit (TP/SL)
• 💥 = Bullish Trend
• 🔥 = Bearish Trend

--------------------------------------------------
Backtest System
--------------------------------------------------
• Displays the number of days since the first trade/backtest.
• Shows trade count, win rate, net profit/loss.
• Useful for real-time analysis and alert validation.

--------------------------------------------------
Dashboard Overview
--------------------------------------------------
Row 1 (Per Symbol):
• Column 1: Win Rate + Total Trades / Wins / Losses
• Color Modes: Blue = Win rate rising and it's 50 or higher. Brown = Win rate falling and it's 50 or higher. Grey = Falling and less than 50

• Column 2: Backest - number of days since the first trade

• Column 3: Net Profit + Total Profit / Total Loss
• Color Modes: Red = Loss greater than Profit , Green = Net Profit exceeds minimum profit x Total Trade Won, Brown = Profit greater than Loss but high bad trades

• Column 4: Investment Amount + Minimum Profit | Gain % to Target
• Color Modes: Signal State: Lime = Long, Maroon = Short, Yellow = Both Active
--------------------------------------------------
Usage Notes
--------------------------------------------------
• Works for manual or automated execution.
• Fully compatible with WunderTrading’s JSON alert format (and any platform using the same format).
• Can also be used standalone with no dependencies.
• Dashboard and auto-calculated SL/TP make it flexible across all trading styles.
• Minimum Investment Amount affects SL/TP size and therefore win rate.
• Increasing Minimum Profit increases potential profit but also increases loss size.
• Loss-to-Win ratio is always 1:2+, meaning your wins are at least double your losses.
• Optimized for 1-minute timeframe. Other timeframes may also yield desirable results.

--------------------------------------------------
⚠️ Disclaimer
--------------------------------------------------
This indicator does not constitute financial advice or a trading recommendation.
All trading involves risk. Past performance does not guarantee future results.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.