OPEN-SOURCE SCRIPT

SMA Dow-Flow MTF (SAXO Logical Alert)

48
This script is an advanced MTF (multi-timeframe) monitor that combines the concepts of Dow Theory and SMA (Single Moving Average) to capture the moment when trends align across multiple timeframes. It is particularly focused on visualizing when lower timeframes synchronize with the direction of higher timeframes, without being distracted by short-term noise. 1. Trend Determination Mechanism (Core Logic): Rather than the usual simple determination of whether a price is above or below a moving average, this is based on updates of "low lows and highs." Pivot Detection: Points where the SMA moves in a "V" or "inverted V" shape are recorded as reversal candidates ($lastH$, $lastL$). Trend Reversal Conditions: Uptrend: When the price clearly breaks above the most recent SMA high ($lastH$). Downtrend: When the price clearly breaks below the most recent SMA low ($lastL$). 2. Indicator Features ① Sync Hierarchy: This script counts the degree to which the direction of each time period matches that of the higher time period, starting from the lower time period. The 5-minute time period forms a trend. The 15-minute time period follows the same direction as the 5-minute time period. The 1-hour time period follows the same direction as the 15-minute time period... (continues up to the daily time period). This ensures that an alert is sent out when the larger trend (daily or 4-hourly) swallows up the smaller trend (5-minute or 15-minute). ② Set Selection: You can switch between the "Yen Set (AUDJPY, EURJPY, etc.)" and the "Dollar Set (EURUSD, GBPUSD, etc.)." This allows you to grasp the strength or weakness of a specific currency (e.g., a weak yen or a strong dollar) at a glance.

This script's alert function does not simply sound when the trends match, but is designed to pinpoint the moment when the number of trend synchronizations increases (i.e., when momentum increases).

Below, we will explain in detail how it works and the meaning of the notifications.

1. Alert Conditions
An alert will only be triggered when all three of the following conditions are met.

Increase in Sync Count: For example, if only two time frames, the 5-minute and 15-minute ones, were aligned (Sync: 2), and the 1-hour one also aligns in the same direction (Sync: 3), the alert will be triggered.

Above the set minimum count (alert_min): The default setting is "3." In this case, a notification will be triggered the moment three, four, or five time frames are synchronized.

Selected Set Only: If the "Yen Set" is displayed, an alert will not be triggered even if a currency pair in the Dollar Set is synchronized.

2. How to Read the Alert Message
When you receive a notification, the following message will be displayed.

USDJPY: 4-Bar Synchronization (Upward)

USDJPY: A Currency Pair Gaining Momentum

4-Bar Synchronization: Indicates that the direction of the four timeframes (5-minute, 15-minute, 1-hour, and 4-hour) is consistent, starting with the lowest timeframe.

Upward/Downward: The direction of the synchronization.

このスクリプトは、「ダウ理論」と「移動平均線(SMA)」の考え方を組み合わせ、複数の時間足でトレンドが揃った瞬間を捉えるための高度なMTF(マルチタイムフレーム)モニターです。特に、短期的なノイズに惑わされず、上位足の方向に下位足が同期したタイミングを視覚化することに特化しています。1. トレンド判断の仕組み(コアロジック)通常の「移動平均線より上か下か」という単純な判定ではなく、「押し安値・戻り高値」の更新をベースにしています。ピボットの検知: SMAが「V字」または「逆V字」に動いた地点を、反転の候補($lastH$, $lastL$)として記録します。トレンド転換の条件:上昇トレンド: 価格が直近のSMA高値($lastH$)を明確に上抜けたとき。下落トレンド: 価格が直近のSMA安値($lastL$)を明確に下抜けたとき。2. インジケーターの特徴① 同期(Sync)の階層構造このスクリプトは、下位足から順に「どれだけ上位足と方向が一致しているか」をカウントします。5分足がトレンドを形成。15分足が5分足と同じ方向。1時間足が15分足と同じ方向……(日足まで続く)これにより、「大きな流れ(日足・4時間足)に、小さな流れ(5分・15分)が飲み込まれた瞬間」を逃さずアラート通知します。② セット選択機能「円セット(AUDJPY, EURJPYなど)」と「ドルセット(EURUSD, GBPUSDなど)」を切り替えて表示できます。これにより、特定の通貨の強弱(円安・ドル高など)を一目で把握できるのが強みです。

このスクリプトのアラート機能は、単に「トレンドが一致した」ときに鳴るのではなく、**「トレンドの同期数が増加した瞬間(=勢いが増した瞬間)」**をピンポイントで通知するように設計されています。

以下に、その仕組みと通知内容の意味を詳しく解説します。

1. アラートが発生する条件
アラートは、以下の3つの条件がすべて揃った時にのみ発信されます。

同期数(Sync Count)の増加: 例えば、それまで「5分足と15分足」の2つしか揃っていなかった(Sync: 2)のが、新しく「1時間足」も同じ方向に揃った(Sync: 3)という変化の瞬間に鳴ります。

設定した最小数以上 (alert_min): 初期設定では「3」になっています。この場合、3つ、4つ、または5つの時間足が同期した瞬間に通知が飛びます。

選択中のセットのみ: 「円セット」を表示している時は、ドルセットの通貨ペアが同期してもアラートは鳴りません。

2. アラートメッセージの読み方
通知が来ると、以下のようなメッセージが表示されます。

USDJPY: 4足同期 (上昇)

USDJPY: 勢いが出た通貨ペア

4足同期: 下位足から順に「5分・15分・1時間・4時間」の4つの時間足で方向が一致したことを示します。

上昇 / 下落: その同期している方向です。

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.