OPEN-SOURCE SCRIPT

FractalMod for TV with breakout alerts

133
FractalsMod (MT4 → Pine) is a TradingView indicator converted from a custom MT4 (MQL4) fractal indicator.

This script replicates the behavior of the original MT4 version as closely as possible, including:

Confirmation-based fractals using left/right bar logic

Persistent horizontal levels derived from confirmed fractals

MT4-style “buffer-like” behavior using segmented horizontal lines

Key Features

MT4-compatible fractal logic
Uses leftbars and rightbars to confirm fractal highs/lows, equivalent to MT4 custom fractal indicators.

Segmented horizontal lines (MT4 buffer style)
Each confirmed fractal starts a new horizontal line segment from the original pivot bar.
When a new fractal is confirmed, the previous segment is stopped at the new pivot point, closely mimicking MT4 indicator buffers.

Latest fractal tracking
The most recently confirmed Up/Down fractal levels are tracked internally and used for breakout detection.

Breakout alerts (not confirmation alerts)
Alerts are triggered when the current price breaks above the latest Up fractal or below the latest Down fractal.
Breakout detection can be configured to use:

Close price only (confirmation-based), or

High/Low including wicks.

Clean visual control

Single arrow per confirmed fractal (no duplicate markers)

Optional display of fractal markers and horizontal lines

Custom colors and line width for Up/Down fractals

Typical Use Cases

Fractal-based support / resistance visualization

Breakout trading using the most recent confirmed fractal levels

MT4 → TradingView workflow migration while preserving indicator behavior

This script is designed for traders familiar with MT4 fractal indicators who want a faithful and practical TradingView equivalent without repainting on confirmed signals.

FractalsMod (MT4 → Pine) は、
MT4(MQL4)で使用されていた カスタム Fractal インジケーターを TradingView(Pine Script)へ移植したものです。

元の MT4 インジケーターの挙動を可能な限り忠実に再現することを目的としており、以下の特徴を持ちます。

主な特徴

MT4互換のフラクタル判定ロジック
leftbars / rightbars を用いたフラクタル確定方式で、
MT4 のカスタム Fractal インジケーターと同等の確定条件を再現しています。

MT4のバッファ挙動を再現した水平ライン
フラクタルが確定すると、その ピボット位置から水平ラインを開始します。
新しいフラクタルが確定した場合、それまでのラインは新しいピボット位置で停止し、
区間ごとのライン構造で MT4 のバッファ表示に近い見た目を実現しています。

最新フラクタル価格の内部保持
直近で確定した Up / Down フラクタル価格を保持し、
ブレイク判定やアラートに利用します。

ブレイク専用アラート(確定時アラートなし)
フラクタル確定時ではなく、

価格が最新の Up フラクタルを上抜けたとき

価格が最新の Down フラクタルを下抜けたとき
にアラートを出す設計です。

ブレイク判定は

終値ベース(ダマシを減らす)

ヒゲ込み(高値 / 安値)
を設定で切り替えられます。

視認性と制御性を重視した設計

フラクタル矢印は 確定時に1本のみ表示(重複なし)

Up / Down で色分けされたラインと矢印

ライン表示・矢印表示の ON / OFF 切り替え可能

想定される用途

フラクタルを用いた サポート / レジスタンスの可視化

直近フラクタルを基準とした ブレイクアウト戦略

MT4 から TradingView への移行時に、
ロジックと見た目をできるだけ変えずに使いたい場合

本スクリプトは、
MT4のフラクタル系インジケーターに慣れたトレーダーが、
TradingViewでも違和感なく使えることを重視して設計されています。

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。