OPEN-SOURCE SCRIPT
Anya1

This script is a **Trend-Following Momentum Strategy** specifically designed for **Gold (XAUUSD)** but applicable to other assets. It combines an oscillator (to find entry points) with two moving averages (to ensure you are trading with the trend).
Here is a breakdown of how the logic works and how to read the signals on your chart.
---
### 1. The Strategy "Gears" (The Filters)
The script uses a "triple-filter" system. A signal is only generated when all three of these conditions click into place at the exact same time:
* **Gear 1: Momentum (Cipher Twister):** This oscillator looks for "turning points." It identifies when the market is exhausted.
* **Buy:** The momentum lines cross while **below the zero line** (recovering from oversold).
* **Sell:** The momentum lines cross while **above the zero line** (dropping from overbought).
* **Gear 2: Medium-Term Trend (MA 25):** The price must be on the "correct" side of the **Yellow Line**. This ensures that the immediate price action is moving in your favor.
* **Gear 3: Macro Trend (MA 150):** This is the final gatekeeper (the **White Line**). You are forbidden from buying if the price is below this line, and forbidden from selling if it is above. This keeps you on the right side of the "Big Picture."
---
### 2. How to Read the Signals
| Signal | Chart Visual | Rule |
| --- | --- | --- |
| **BUY** | **Green "BUY" Label** | Price is above the Yellow & White lines + Oscillator crossed below zero. |
| **SELL** | **Red "SELL" Label** | Price is below the Yellow & White lines + Oscillator crossed above zero. |
**Visual Confirmation:** The script will also highlight the background in **Lime** for a Buy and **Red** for a Sell to make it impossible to miss.
---
### 3. Risk Management (The Exit)
This version is built as a **Strategy**, meaning it has a built-in "Exit Plan" for every trade:
* **Stop Loss (SL):** 100 Pips ($10.00 move in Gold).
* **Take Profit (TP):** 120 Pips ($12.00 move in Gold).
When a trade is entered, TradingView will automatically track the price. If it hits your target, the trade closes in profit. If it hits your stop, it closes to protect your capital.
---
### 5. Best Use Cases
* **Trending Markets:** This script thrives when Gold is in a clear uptrend or downtrend.
* **Timeframes:** It is most effective on the **15-minute (15M)** or **1-hour (1H)** charts. Lower timeframes (like the 1M) may hit the Stop Loss too frequently due to market noise.
**Would you like me to add a "Trailing Stop" feature, so the strategy locks in profits automatically as the price moves in your favor?**
Here is a breakdown of how the logic works and how to read the signals on your chart.
---
### 1. The Strategy "Gears" (The Filters)
The script uses a "triple-filter" system. A signal is only generated when all three of these conditions click into place at the exact same time:
* **Gear 1: Momentum (Cipher Twister):** This oscillator looks for "turning points." It identifies when the market is exhausted.
* **Buy:** The momentum lines cross while **below the zero line** (recovering from oversold).
* **Sell:** The momentum lines cross while **above the zero line** (dropping from overbought).
* **Gear 2: Medium-Term Trend (MA 25):** The price must be on the "correct" side of the **Yellow Line**. This ensures that the immediate price action is moving in your favor.
* **Gear 3: Macro Trend (MA 150):** This is the final gatekeeper (the **White Line**). You are forbidden from buying if the price is below this line, and forbidden from selling if it is above. This keeps you on the right side of the "Big Picture."
---
### 2. How to Read the Signals
| Signal | Chart Visual | Rule |
| --- | --- | --- |
| **BUY** | **Green "BUY" Label** | Price is above the Yellow & White lines + Oscillator crossed below zero. |
| **SELL** | **Red "SELL" Label** | Price is below the Yellow & White lines + Oscillator crossed above zero. |
**Visual Confirmation:** The script will also highlight the background in **Lime** for a Buy and **Red** for a Sell to make it impossible to miss.
---
### 3. Risk Management (The Exit)
This version is built as a **Strategy**, meaning it has a built-in "Exit Plan" for every trade:
* **Stop Loss (SL):** 100 Pips ($10.00 move in Gold).
* **Take Profit (TP):** 120 Pips ($12.00 move in Gold).
When a trade is entered, TradingView will automatically track the price. If it hits your target, the trade closes in profit. If it hits your stop, it closes to protect your capital.
---
### 5. Best Use Cases
* **Trending Markets:** This script thrives when Gold is in a clear uptrend or downtrend.
* **Timeframes:** It is most effective on the **15-minute (15M)** or **1-hour (1H)** charts. Lower timeframes (like the 1M) may hit the Stop Loss too frequently due to market noise.
**Would you like me to add a "Trailing Stop" feature, so the strategy locks in profits automatically as the price moves in your favor?**
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.