OPEN-SOURCE SCRIPT

Mossan's Farming System [Taolue Remix]

100
Mossan's Farming System [Taolue Remix]

[JP]
**【概要】**
このインジケーターは、「物理的なコスト(**WTI原油価格**)」と「金融的なコスト(**米10年債利回り**)」という2つのマクロ指標を監視し、現在の市場が**「農耕(トレンドフォロー)」**に適しているか、**「嵐(高ボラティリティ・警戒)」**の状態にあるかを背景色で可視化します。
さらに、環境認識に基づいたRSIの押し目買い・戻り売りシグナルと、ダイバージャンス検知機能を提供します。

**【コンセプト:狩猟から農耕へ】**
* **🌱 農耕モード (背景:緑)**
* 原油価格と米金利が共に移動平均を**下回っている**状態。
* 実体経済へのコスト負担が軽く、流動性が確保されています。
* **戦略:** 押し目買い(**Plant**)推奨。トレンドが育ちやすい土壌です。

* **⚠️ 嵐/警戒モード (背景:赤)**
* 原油価格と米金利が共に移動平均を**上回っている**状態。
* インフレ懸念と金融引き締めが同時に起きている「カオス」な状態です。
* **戦略:** キャッシュポジション推奨、または短期的な戻り売り(**Harvest**)。

* **☁️ 待機 (背景:グレー)**
* 方向感が定まらない状態。無理にトレードせず**「休む」**期間です。

**【機能とロジック】**
1. **マクロ環境認識:**
* **USOIL** (WTI原油) と **US10Y** (米10年債利回り) を取得し、指定した移動平均線(MA)と比較します。
* **マルチタイムフレーム対応:** 設定から「環境認識を行う時間足」を固定できます(例:15分足チャートを見ながら、**日足**の環境を表示)。
* **カスタムMA:** 環境判定に使うMAの種類を **SMA, EMA, HMA, WMA** 等から選択可能です。

2. **売買シグナル (Plant & Harvest):**
* **Plant (買い):** 環境が「緑」かつ、RSIが**売られすぎ**水準から復帰した時。
* **Harvest (売り):** 環境が「赤」かつ、RSIが**買われすぎ**水準から反落した時。
* 環境認識フィルターにより、マクロ環境に逆行する危険なシグナルを排除します。

3. **RSIダイバージャンス:**
* 強気(**Bull**)および弱気(**Bear**)のダイバージャンスを自動検知し、チャート上にラインを描画します。

**【設定】**
* **環境認識の時間足:** デフォルトはチャートと同じですが、「**D(日足)**」などに固定することを推奨します。
* **MAの種類/期間:** 反応速度を調整できます(デフォルト: SMA 20)。
* **RSI設定:** 期間や感度を調整可能です。

---

[EN]
**[Overview]**
This indicator visualizes the current market regime by monitoring two key macro factors: **Physical Cost (WTI Crude Oil)** and **Financial Cost (US 10Y Yield)**. It determines whether the market is in a **"Farming Mode" (Safe/Trend Following)** or a **"Storm Mode" (High Volatility/Risk-Off)** based on background colors.
It also provides RSI-based buy/sell signals filtered by this macro environment, along with divergence detection.

**[Concept: Farming vs. Hunting]**
* **🌱 Farming Mode (Green Background)**
* Both Oil and Yields are **below** their moving averages.
* Indicates lower operational costs for the economy and stable liquidity.
* **Strategy:** Look for dip buys (**Plant**). Trends are likely to grow steadily.

* **⚠️ Storm Mode (Red Background)**
* Both Oil and Yields are **above** their moving averages.
* Indicates inflation fears and monetary tightening. High risk.
* **Strategy:** Stay in cash or look for short-term selling opportunities (**Harvest**).

* **☁️ Wait (Gray Background)**
* Mixed signals. It is recommended to **wait** for a clearer direction.

**[Features & Logic]**
1. **Macro Environment Recognition:**
* Fetches data for **USOIL** and **US10Y** to compare against a user-defined Moving Average.
* **Multi-Timeframe Support:** You can fix the timeframe for environment detection (e.g., view **Daily** environment on a 15m chart).
* **Custom MA Types:** Choose from **SMA, EMA, HMA, WMA**, etc., for the trend detection logic.

2. **Trading Signals (Plant & Harvest):**
* **Plant (Buy):** Triggered when the environment is "Green" AND RSI crosses up from the **oversold** zone.
* **Harvest (Sell):** Triggered when the environment is "Red" AND RSI crosses down from the **overbought** zone.
* The environment filter helps filter out dangerous counter-trend signals.

3. **RSI Divergence:**
* Automatically detects and draws lines for **Bullish** and **Bearish** RSI divergences.

**[Settings]**
* **Environment Timeframe:** Default is same as chart, but fixing it to higher timeframes (e.g., "**D**") is recommended for stability.
* **MA Type/Length:** Adjust the sensitivity of the trend detection (Default: SMA 20).
* **RSI Settings:** Customizable length and thresholds.

**Disclaimer:**
This script is for educational purposes only. Past performance does not guarantee future results. Please manage your risk carefully.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.