OPEN-SOURCE SCRIPT
EMA and Dow Theory Strategies

🌐 Strategy Description
📘 Overview
This is a hybrid strategy that combines EMA crossovers, Dow Theory swing logic, and multi-timeframe trend overlays. It is suitable for intraday to short-term trading on any asset class: crypto, forex, stocks, and indices.
The strategy provides precise entry/exit signals, dynamic stop-loss and scale-out, and highly visual trade guidance.
🧠 Key Features
・Dual EMA crossover system (applied to both symbol and external index)
・Dow Theory-based swing high/low detection for trend confirmation
・Visual overlay of higher timeframe swing trend (htfTrend)
・RSI filter to avoid overbought/oversold entries
・Dynamic partial take-profit when trend weakens
・Custom stop-loss (%) control
・Visualized trade PnL labels directly on chart
・Alerts for entry, stop-loss, partial exit
・Gradient background zones for swing zones and trend visualization
・Auto-tracked metrics: APR, drawdown, win rate, equity curve
⚙️ Input Parameters
| Parameter | Description |
| ------------------------- | -------------------------------------------------------- |
| Fast EMA / Slow EMA | Periods for detecting local trend via EMAs |
| Index Fast EMA / Slow EMA | EMAs applied to external reference index |
| StopLoss | Maximum loss threshold in % |
| ScaleOut Threshold | Scale-out percentage when trend changes color |
| RSI Period / Levels | RSI period and overbought/oversold levels |
| Swing Detection Length | Number of bars used to detect swing highs/lows |
| Stats Display Options | Toggle PnL labels and position of statistics table |
🧭 About htfTrend (Higher Timeframe Trend)
The script includes a higher timeframe trend (htfTrend) calculated using Dow Theory (pivot highs/lows).
This trend is only used for visual guidance, not for actual entry conditions.
Why? Strictly filtering trades by higher timeframe often leads to missed opportunities and low frequency.
By keeping htfTrend visual-only, traders can still refer to macro structure but retain trade flexibility.
Use it as a contextual tool, not a constraint.
ストラテジー説明
📘 概要
本ストラテジーは、EMAクロスオーバー、ダウ理論によるスイング判定、**上位足トレンドの視覚表示(htfTrend)**を組み合わせた複合型の短期トレーディング戦略です。
仮想通貨・FX・株式・指数など幅広いアセットに対応し、デイトレード〜スキャルピング用途に適しています。
動的な利確/損切り、視覚的にわかりやすいエントリー/イグジット、統計表示を搭載しています。
🧠 主な機能
・対象銘柄+外部インデックスのEMAクロスによるトレンド判定
・ダウ理論に基づいたスイング高値・安値検出とトレンド判断
・上位足スイングトレンド(htfTrend)の視覚表示
・RSIフィルターによる過熱・売られすぎの回避
・トレンドの弱まりに応じた部分利確(スケールアウト)
・**損切り閾値(%)**をカスタマイズ可能
・チャート上に損益ラベル表示
・アラート完備(エントリー・決済・部分利確)
・トレンドゾーンを可視化する背景グラデーション
・勝率・ドローダウン・APR・資産増加率などの自動表示
| 設定項目名 | 説明内容 |
| --------------------- | -------------------------- |
| Fast EMA / Slow EMA | 銘柄に対して使用するEMAの期間設定 |
| Index Fast / Slow EMA | 外部インデックスのEMA設定 |
| 損切り(StopLoss) | 損切りラインのしきい値(%で指定) |
| 部分利確しきい値 | トレンド弱化時にスケールアウトする割合(%) |
| RSI期間・水準 | RSI計算期間と、過熱・売られすぎレベル設定 |
| スイング検出期間 | スイング高値・安値の検出に使用するバー数 |
| 統計表示の切り替え | 損益ラベルや統計テーブルの表示/非表示選択 |
🧭 上位足トレンド(htfTrend)について
本スクリプトには、上位足でのスイング高値・安値の更新に基づく**htfTrend(トレンド判定)が含まれています。
これは視覚的な参考情報であり、エントリーやイグジットには直接使用されていません。**
その理由は、上位足を厳密にロジックに組み込むと、トレード機会の損失が増えるためです。
このスクリプトでは、**判断の補助材料として「表示のみに留める」**設計を採用しています。
→ 裁量で「利確を早める」「逆張りを避ける」判断に活用可能です。
📘 Overview
This is a hybrid strategy that combines EMA crossovers, Dow Theory swing logic, and multi-timeframe trend overlays. It is suitable for intraday to short-term trading on any asset class: crypto, forex, stocks, and indices.
The strategy provides precise entry/exit signals, dynamic stop-loss and scale-out, and highly visual trade guidance.
🧠 Key Features
・Dual EMA crossover system (applied to both symbol and external index)
・Dow Theory-based swing high/low detection for trend confirmation
・Visual overlay of higher timeframe swing trend (htfTrend)
・RSI filter to avoid overbought/oversold entries
・Dynamic partial take-profit when trend weakens
・Custom stop-loss (%) control
・Visualized trade PnL labels directly on chart
・Alerts for entry, stop-loss, partial exit
・Gradient background zones for swing zones and trend visualization
・Auto-tracked metrics: APR, drawdown, win rate, equity curve
⚙️ Input Parameters
| Parameter | Description |
| ------------------------- | -------------------------------------------------------- |
| Fast EMA / Slow EMA | Periods for detecting local trend via EMAs |
| Index Fast EMA / Slow EMA | EMAs applied to external reference index |
| StopLoss | Maximum loss threshold in % |
| ScaleOut Threshold | Scale-out percentage when trend changes color |
| RSI Period / Levels | RSI period and overbought/oversold levels |
| Swing Detection Length | Number of bars used to detect swing highs/lows |
| Stats Display Options | Toggle PnL labels and position of statistics table |
🧭 About htfTrend (Higher Timeframe Trend)
The script includes a higher timeframe trend (htfTrend) calculated using Dow Theory (pivot highs/lows).
This trend is only used for visual guidance, not for actual entry conditions.
Why? Strictly filtering trades by higher timeframe often leads to missed opportunities and low frequency.
By keeping htfTrend visual-only, traders can still refer to macro structure but retain trade flexibility.
Use it as a contextual tool, not a constraint.
ストラテジー説明
📘 概要
本ストラテジーは、EMAクロスオーバー、ダウ理論によるスイング判定、**上位足トレンドの視覚表示(htfTrend)**を組み合わせた複合型の短期トレーディング戦略です。
仮想通貨・FX・株式・指数など幅広いアセットに対応し、デイトレード〜スキャルピング用途に適しています。
動的な利確/損切り、視覚的にわかりやすいエントリー/イグジット、統計表示を搭載しています。
🧠 主な機能
・対象銘柄+外部インデックスのEMAクロスによるトレンド判定
・ダウ理論に基づいたスイング高値・安値検出とトレンド判断
・上位足スイングトレンド(htfTrend)の視覚表示
・RSIフィルターによる過熱・売られすぎの回避
・トレンドの弱まりに応じた部分利確(スケールアウト)
・**損切り閾値(%)**をカスタマイズ可能
・チャート上に損益ラベル表示
・アラート完備(エントリー・決済・部分利確)
・トレンドゾーンを可視化する背景グラデーション
・勝率・ドローダウン・APR・資産増加率などの自動表示
| 設定項目名 | 説明内容 |
| --------------------- | -------------------------- |
| Fast EMA / Slow EMA | 銘柄に対して使用するEMAの期間設定 |
| Index Fast / Slow EMA | 外部インデックスのEMA設定 |
| 損切り(StopLoss) | 損切りラインのしきい値(%で指定) |
| 部分利確しきい値 | トレンド弱化時にスケールアウトする割合(%) |
| RSI期間・水準 | RSI計算期間と、過熱・売られすぎレベル設定 |
| スイング検出期間 | スイング高値・安値の検出に使用するバー数 |
| 統計表示の切り替え | 損益ラベルや統計テーブルの表示/非表示選択 |
🧭 上位足トレンド(htfTrend)について
本スクリプトには、上位足でのスイング高値・安値の更新に基づく**htfTrend(トレンド判定)が含まれています。
これは視覚的な参考情報であり、エントリーやイグジットには直接使用されていません。**
その理由は、上位足を厳密にロジックに組み込むと、トレード機会の損失が増えるためです。
このスクリプトでは、**判断の補助材料として「表示のみに留める」**設計を採用しています。
→ 裁量で「利確を早める」「逆張りを避ける」判断に活用可能です。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。