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?**
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.