OPEN-SOURCE SCRIPT

ZigZag Break - Phase 3 Toggle Sync V open

612
1. OverviewThis script is a technical indicator that detects high/low breakouts based on Dow Theory and tracks multi-timeframe (MTF) ZigZag vertices (1 to 6) to perform dynamic synchronization logic.2. Core Features & Logic(1) MTF ZigZag & Dow Theory BreakData Flow (calc_tf / process_zigzag): In 4 distinct layers consisting of the Chart TF, HTF1, HTF2, and HTF3, reversal events are triggered and calculated when the close price breaks the recent confirmed highest high or lowest low.Vertex Numbering (f_draw_labels): Based on the continuity of reversals and structure breaks, vertex states are automatically mapped into digital labels "1", "2", "3", "4", "5", "6" for each timeframe ("0" represents an unconfirmed or baseline state).(2) Status Table & History PanelVisualization (Layer 2): Displays the latest vertex states (1–6) in a left-aligned status table at the top-left of the chart. It also plots historical dots on the chart for the past hist_count bars, mirroring structural transitions over time.(3) Horizontal Line DisplaysVertex Visualization (f_trace_history / f_draw_line):Even (2, 4, 6) Lines: Tracks the price level of the previous even vertex. Optionally deleted if an opposite even vertex appears.Odd (3, 5) Lines: Tracks the latest odd vertex level. Can be configured to show only when an opposite '1' occurs.Even Close Break Line (f_even_brk_logic_final_v3): Once an even (2, 4, 6) vertex is confirmed, a horizontal line extends to the right the exact moment the close price breaks that level. The line resets automatically if an opposite even vertex forms.(4) Multi-Timeframe Synchronization Alerts (End of Script Logic)Sync Criteria & Trigger Conditions: Validates whether user-defined criteria (0–6, Odd, Even, 1 or 3, etc.) match and directions (dir) synchronize perfectly across all active timeframes. An alert and a vertical line are triggered exactly once per bar when a "new state confirmation" physically occurs (trigger := true) on the designated trigger timeframe.3. Input SettingsGroup NameInput ParameterDescriptionZigZag SettingsShow Chart / HTF1 / HTF2 / HTF3 ZigZagToggles visibility of ZigZag lines for each specific timeframe.Label Max Count / Line Max CountLimits the maximum number of historical labels and lines displayed on the chart.Show ZigZag Dot Labels (●) / Show Wave Numbers (1-6)Controls the visibility of vertex marker dots and structural numbers (1–6).Dow Theory Alert SettingsShow Dow Theory Break / Fill Break BackgroundToggles display of Dow Theory break levels and background fills.History Display SettingsShow Chart / HTF1 / HTF2 / HTF3 HistoryToggles visibility of historical status dots for each timeframe layer.History Dot Count / Text Right OffsetSets the number of historical bars to plot and the right margin offset for TF text labels.Recent Even/Odd Line SettingsShow Chart / HTF1 / HTF2 / HTF3 LinesToggles horizontal lines (even/odd) for each specific timeframe.Show Prev Even (2,4,6) LinesDisplays the horizontal price line of the previous even vertex.↑ Delete if Recent Even is Opposite SideAutomatically deletes the line if the latest even vertex forms on the opposite side.Show Recent Odd (3,5) LinesDisplays the horizontal price line of the latest odd vertex.↑ Show Odd Only When Opposite '1' OccursRestricts the odd line display to only when an opposite '1' is confirmed.Even (2,4,6) Break LineDraws horizontal lines from even vertices that have been broken by the close price.Additional Alert SettingsHTF3 / HTF2 / HTF1 Condition / Chart TF AlertSelects specific conditions (numbers, odd/even, 1 or 3) required to trigger the sync alert.

【日本語版 / Japanese Version】1. 概要本スクリプトは、ダウ理論に基づく高値・安値のブレイクアウト、および複数時間軸(MTF)のジグザグ頂点(1〜6)の状態を検出し、動的に同期判定を行うテクニカル指標です。2. コア機能とロジック① マルチ時間軸ジグザグ & ダウ理論ブレイクデータフロー(calc_tf / process_zigzag): 表示足(標準足)、および上位足1(HTF1)、上位足2(HTF2)、上位足3(HTF3)の計4層において、終値が直近の最高値・最安値を更新した事実(確定値)をトリガーに転換イベントを判定します。頂点番号のナンバリング(f_draw_labels): 転換および高安値更新の連続性に基づき、各時間軸の頂点に対して「1」「2」「3」「4」「5」「6」のデジタルな状態(ラベル)を自動的にマッピングします(未確定時は「0」)。② ステータステーブル & 履歴表示可視化(第2レイヤー): チャート左上に各タイムフレームの最新ステータス(1〜6)をテーブルで左詰めに表示します。また、過去 hist_count 本分にわたり、各バー時点での状態をヒストリカルドットとしてチャート上にプロットし、時系列での構造変化を鏡のように映し出します。③ 水平線描画(偶数・奇数・終値ブレイク)直近頂点の可視化(f_trace_history / f_draw_line):偶数(2, 4, 6)ライン: 一つ前の偶数頂点価格を追跡。オプションにより反対側の偶数出現で自動消去。奇数(3, 5)ライン: 直近の奇数頂点価格を追跡。反対側の「1」が発生した際のみ表示する規律を設定可能。偶数終値ブレイクライン(f_even_brk_logic_final_v3): 偶数(2, 4, 6)頂点の確定後、終値でその価格を完全にブレイクした瞬間に、その起点価格から右側へ水平線を描画します。反対側の偶数が出現した場合は自動的にリセット(消去)されます。④ 多重時間軸同期アラート(最後尾ロジック)同期判定とトリガー条件: 各時間軸に対してユーザーが指定した条件(0〜6、奇数、偶数、1or3など)がすべて合致し、かつタイムフレーム間で方向性(dir)が完全に一致している(同期している)状態を検証します。その上で、選択されたトリガー足において「新たな状態の確定」が物理的に発生した瞬間(trigger := true)にのみ、アラートおよび垂直ラインによる通知を1本に限定して実行します。3. インプット設定項目グループ名設定項目説明ジグザグ設定表示足 / 上位足1 / 上位足2 / 上位足3 de ジグザグを表示各時間軸のジグザグ線の表示・非表示を切り替えます。ラベルの表示本数 / 線の表示本数ラベルおよび直近の線の最大表示本数を制限します。ジグザグ頂点ラベル(●)を表示 / 頂点数字を表示頂点の●マークおよび「1〜6」の数字の表示を制御します。ダウ理論通知設定ダウ理論ブレイクを表示 / ブレイク背景を塗りつぶすダウ理論ブレイクラインと、その背景塗りつぶし表示を制御します。履歴表示設定標準足 / 上位足1 / 上位足2 / 上位足3の履歴を表示各時間軸の履歴(ドット)の表示・非表示を切り替えます。履歴ドットの表示件数 / テキストの右オフセット量履歴を遡るバー数と、タイムフレーム名テキストの右余白量を設定します。直近の「偶数」「奇数」水平線設定表示足 / 上位足1 / 上位足2 / 上位足3の偶数・奇数水平線各時間軸の水平線(偶数・奇数)を表示するかどうかを選択します。一つ前の「偶数(2,4,6)」水平線を表示一つ前の偶数頂点価格に水平線を表示します。↑ 直近の偶数が反対側なら削除直近の偶数が反対側に現れた際、古い線を自動消去します。直近の「奇数(3,5)」水平線を表示直近の奇数頂点価格に水平線を表示します。↑ 奇数は反対の1が発生した時のみ表示反対側の「1」が発生した時のみ奇数線を表示する規律を適用します。「2,4,6」の頂点起点・終値ブレイク水平線終値でブレイクされた偶数起点の水平線を描画します。追加アラート設定上位足3 / 上位足2 / 上位足1の条件選択 / 表示足のアラート表示通知同期アラートの条件(数値や偶奇、1or3など)を選択します。

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน