OPEN-SOURCE SCRIPT

SMA Reversal Sequential MTF

362
SMA Reversal Sequential MTF (Multi-Timeframe)OverviewThe SMA Reversal Sequential MTF is a professional-grade price action tool designed to detect qualitative trend shifts and structural breakouts across multiple timeframes simultaneously. Unlike standard crossover indicators, this script analyzes the "curvature" of the Simple Moving Average (SMA) to identify when the market's average momentum has genuinely rotated.1. Core Logic: SMA Slope CurvatureThe script detects a trend reversal when the SMA (20-period by default) changes its trajectory from a "V-shape" (bottoming out) or an "Inverted V-shape" (topping out).The Reversal Algorithm:Bullish Reversal: Occurs when the SMA value at a specific historical offset is higher than the intermediate offset, but the intermediate offset is lower than the most recent value.Bearish Reversal: Occurs when the SMA value at a specific historical offset is lower than the intermediate offset, but the intermediate offset is higher than the most recent value.By using an OFFSET parameter, the script filters out minor price noise, ensuring that only significant rotations in the moving average are labeled.2. Structural Breakout Detection (MSB)Once a reversal is confirmed, the script automatically identifies the Market Structure of that specific timeframe by looking back at the highest high or lowest low within a defined period (LOOKBK).How Breakouts Work:Level Anchoring: When a reversal is detected, the script "locks in" the highest/lowest price of that swing.Confirmation: A "BREAK" signal and a horizontal line are generated only when a candle closes beyond this structural level.Visual Persistence: The break-line is extended to the right, providing a clear visual reference for support-turned-resistance (or vice versa).3. Advanced Multi-Timeframe (MTF) IntegrationMonitor up to 6 timeframes (5M, 15M, 1H, 4H, 1D, 1W) on a single chart.Auto-Filtering (hideLowerTF): To maintain chart clarity, the script can automatically hide timeframe data that is lower than your current chart (e.g., if you are on a 1H chart, 5M and 15M labels are hidden).Non-Repainting: Built using barmerge.gaps_on and confirmed candle logic, ensuring that historical signals remain accurate and do not disappear or move after the fact.4. Dual Preset ModesSwitch between two specialized trading styles with a single click in the settings:PresetParameters (SMA / Offset / Lookback)Ideal ForStandard (Default)20 / 6 / 20Trend following, swing trading, and major pullbacks.Short-Term5 / 4 / 7Scalping, fast day trading, and sensitive structure shifts.5. Visual Interface FeaturesTimeframe Labels: Clearly indicates which timeframe has rotated (e.g., "1H", "15M").Dynamic BREAK Labels: Labels follow the price action with a customizable right-side offset, ensuring they never overlap with the candles.Memory Management: Uses Pine Script Arrays to manage objects, ensuring the script runs smoothly without hitting the platform's drawing limits.6. How to Trade with This ScriptConfluence Trading: Wait for a "BREAK" on a higher timeframe (e.g., 4H) and then look for a matching "REVERSAL" on a lower timeframe (e.g., 15M) to refine your entry.Trailing Stops: Use the structural breakout lines as logical levels for stop-loss placement or profit-taking targets.Technical SpecificationsLanguage: Pine Script v5Overlay: YesAlerts: Compatible with standard alert functions.

このインジケーターは、**「トレンドの質的な転換」と「構造的な重要水準の打破(ブレイク)」**を、マルチタイムフレーム(MTF)で同時に監視する総合的なプライスアクションツールです。1. コア・コンセプト:SMA Reversal通常の移動平均線クロスオーバーとは異なり、このスクリプトは**SMA(単純移動平均線)の「曲率(カーブ)」**に着目します。判定アルゴリズムSMAが「下落から上昇」または「上昇から下落」へ変化する瞬間を、特定のオフセット(間隔)を用いて検知します。上昇転換(V字回復): SMA[OFFSET \times 2] > SMA[OFFSET]$ かつ SMA[OFFSET] < SMA[1]$下落転換(逆V字): SMA[OFFSET \times 2] < SMA[OFFSET]$ かつ SMA[OFFSET] > SMA[1]$これにより、価格の一時的なノイズに惑わされず、移動平均線という「相場の平均的な意思」が明確に方向を変えたタイミングを捉えます。2. 構造的ブレイクアウトの検知転換が確認された際、スクリプトはその時点から遡って過去LOOKBK期間内の最高値・最安値を特定します。これが「構造的なレジスタンス・サポート」として機能します。ブレイクの定義水準の固定: 転換が発生した瞬間の高値・安値を、その時間足の「重要ライン」として記憶します。確定足での判定: 終値がそのラインを明確に上抜いた(または下抜いた)時、チャート上に "BREAK" ラベルと水平線を表示します。3. マルチタイムフレーム(MTF)機能このインジケーターの最大の強みは、1つのチャート上に最大6つの時間足(5M, 15M, 1H, 4H, 1D, 1W)の状態を重ねて表示できる点です。自動フィルタリング: hideLowerTF 設定により、5分足チャートを見ている時は全時間足を表示し、日足チャートを見ている時は日足と週足のみを表示するといった、視認性の自動最適化が行われます。非リペイント処理: barmerge.gaps_on を使用した request.security 処理により、過去の検証データにおいて「未来の情報を参照して描画する」リペイント現象を防いでいます。4. 2つのプリセット設定ユーザーは相場の性質に合わせて、設定画面のチェックボックス一つで計算ロジックを切り替えられます。設定名SMA期間 / オフセット / 参照期間特徴標準 (規定値)20 / 6 / 20中長期的なトレンド転換を捉える。押し目買い・戻り売りに最適。短期 (Short)5 / 4 / 7スキャルピングや短期デイトレ用。微細な構造の変化を素早く察知。5. 視覚的インターフェースの説明転換ラベル (5M, 1H等): その時間足でSMAの転換が確定したポイント。常に「最新の1つ」のみが表示されるため、チャートが煩雑になりません。BREAKラベル & ライン: 構造が破壊された価格水準。ラインは右側に延長され、現在の価格との距離感がひと目で分かります。右オフセット: ブレイクラベルを現在価格より右側に配置することで、ローソク足とラベルが重なるのを防ぎます。6. 推奨される活用法上位足のBREAKを待つ: 例えば、1時間足で "1H BREAK" が出ている方向にのみ、5分足や15分足でエントリーを仕掛ける「環境認識」のツールとして非常に強力です。損切りの目安: 表示されたブレイクラインの反対側に価格が戻ってきた場合、構造が否定されたと判断し、迅速な撤退の根拠にできます。技術仕様(開発者向け)言語: Pine Script v5描画制限: 常に最新のオブジェクト(ライン・ラベル)のみを保持するように配列(Array)でメモリ管理を行っており、TradingViewの描画制限エラーを回避しています。計算コスト: request.security を効率的に呼び出しているため、複数の時間足を表示しても動作は軽快です。

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.