OPEN-SOURCE SCRIPT
Aktualisiert

Flow & Value

1 480

■Flow & Value

■Description


■NOTICE / DISCLAIMER
This architecture is NOT a conventional technical analysis tool relying on a combination of superficial, lagging indicators. It is a highly advanced algorithmic volume allocation and multi-state logic simulation engine, specifically designed to extract mathematical edges through the aesthetics of subtraction. It functions as a rigorous state machine, evaluating the convergence of momentum, market structure anomalies, and liquidity distribution under live tick conditions.

■EXECUTIVE SUMMARY

This script is deployed as a technical benchmark for developers building institutional-grade algorithmic dashboards directly on TradingView charts. By stripping away visual noise and focusing purely on deterministic calculations (predictive RSI reversal matrices, FVG confluence, and pro-rata volume distribution), the "Flow & Value Matrix" demonstrates the limits of Pine Script v6 in tracking historical Expected Value (EV) and dynamic session anchoring.

SYSTEM USAGE (How-To / Execution Flow)
Initialization: Apply the script to a high-liquidity chart. The engine immediately begins aggregating historical session data, mapping the background gradient matrix, and initializing the UI dashboard at the specified screen corner.

State Evaluation (Wait Phase): The system continuously evaluates the absolute price requirements for the chosen oscillator (RSI) to reach anomaly levels on the subsequent bar. These levels are plotted dynamically. As long as the price remains outside structural imbalance zones, the UI maintains a neutral "Wait" state.

Confluence Trigger (KILLZONE Phase): When the algorithm detects a geometric intersection between the predictive RSI target and a Higher Timeframe Fair Value Gap (FVG), the state transitions to "KILLZONE". This acts as a strictly mechanical alert for a high-probability mean-reversion setup.

Expected Value Tracking: The internal backtesting engine evaluates historical touch-points of these target vectors against user-defined Take Profit and Stop Loss parameters, updating the EV% dynamically. A positive EV% provides mathematical confirmation of a localized edge.

CONFIGURATION & FILTERING OPTIONS
Dynamic Session Anchoring: Bypassing standard fixed-bar lookbacks, the engine utilizes array-based indexing to detect exact timeframe shifts (e.g., Daily or Weekly opens). This aligns the 3D volume profile matrix precisely with institutional liquidity cycles.

Volatility Variance Engine: An integrated dual-band squeeze detection protocol filters out signals generated in low-volatility environments, warning the user of TP-reach failure risks.

Proximity Scaler: Users can adjust the ATR multiplier to expand or contract the logical detection range of the confluence zones.

SYSTEM CAPABILITIES AND LIMITATIONS
Capabilities:
Deterministic Price Targeting: The script calculates exact numeric thresholds required for momentum reversals prior to the bar closing, eliminating the lagging nature of traditional oscillators.

Visual Synthesis of Financial Volume Data: The depth and opacity of the rendered gradient profile track live traded volume metrics pro-rata, projecting high-volume nodes (POC) in simulated 3D space.

Clean State Machine Transitions: By categorizing market phases into explicit states, the UI enforces strict mechanical discipline.

Limitations (Imposed by Platform API Restrictions):
Lack of Sub-Minute Tick Data: TradingView does not expose raw intra-bar tick data to standard indicator scripts. The engine relies on an advanced pro-rata overlap algorithm to estimate volume distribution across price bins, which remains a mathematical approximation.

Hardware Object Limits and Clipping: TradingView enforces a strict platform ceiling of 500 max labels and 500 max boxes per indicator. If the historical session depth (Number of Historical Profiles) or price bin resolution (Row Count) is scaled excessively high, the internal compiler will automatically clip and delete older visual objects. This is an absolute platform limitation, not a script defect.

ARCHITECTURE & QUANTITATIVE LOGIC (Technical Specifications)
Volume Allocation Engine (Pro-Rata Range Overlap Distribution)
Instead of simple volume summation based on close prices, the script calculates the exact geometric intersection between each bar's High-Low range and the discrete price bins. Let bar high be $H$, bar low be $L$, and volume be $V$. For a bin with bounds BIN\_Top$ and BIN\_Bot$:
If $H > L$:
$Overlap = \max(0, \min(H, Bin\_Top) - \max(L, Bin\_Bot))$
$Ratio = \frac{Overlap}{H - L}$
DV = V \times Ratio$
This loop maps across the dynamically anchored session arrays, building an institutional-grade profile matrix.
Predictive Momentum Targets (Algebraic Reversal)
The engine algebraically expands the RMA formula to solve for the required price variation. To reach a specific target (e.g., 70):
$Target\_RS = \frac{RSI\_Target}{100.0 - RSI\_Target}$
By reversing the smoothing logic, the absolute price coordinate is locked and rendered dynamically.
EV Simulation State Logic
EEV\% = (Win\_Rate \times TP\%) - ((1.0 - Win\_Rate) \times SL\%)$
This discrete simulation runs continuously in the background, proving the statistical viability of the current parameter configuration.

INPUT PARAMETERS REFERENCE & CRITICAL WARNINGS
Group 1 & 2: Timeframe and RSI Core
Macro Timeframe (htf_res): Defines the anchor for FVG anomaly detection.

RSI Length / OB / OS: Configures the predictive algebraic thresholds.
Group 4: Footprint Profile Settings
Profile Anchor Mode (prof_mode): Toggles between static bar counts and dynamic timeframe/session arrays.
Price Row Count (row_count): The resolution of the profile. CRITICAL WARNING: Setting Row Count above 50 while simultaneously increasing the Number of Historical Profiles will exponentially increase Box array generation. This will instantly exhaust TradingView's platform cap of 500 max boxes, triggering an automated visual clipping fault and deleting older profile clusters. Always balance row resolution against history depth to preserve object allocation safety.
=======================================================


Flow & Value
注意/免責事項
本アーキテクチャは、遅行指標を組み合わせた表面的なテクニカル分析ツールではありません。価格アクションから不純物を徹底的に削ぎ落とす「引き算の美学」に基づき、数学的な優位性を抽出するために設計された高度な出来高按分および多状態ロジックシミュレーションエンジンです。モメンタムの逆算、市場構造の欠陥(FVG)、および流動性分布の収束をライブティック条件下で評価する厳格な状態遷移モデルとして機能します。

エグゼクティブ・サマリー

本スクリプトは、TradingView上で機関投資家レベルのアルゴリズム・ダッシュボードを構築する開発者に向けた技術的ベンチマークです。予測的RSI反転マトリックス、FVGコンフルエンス、およびプロラタ出来高按分という決定論的な計算のみに焦点を絞ることで、Pine Script v6におけるヒストリカル期待値(EV)の追跡と動的セッションアンカーの限界を実証します。

システム実行手順(インタラクティブ実行フローの詳細)

初期化: スクリプトを高流動性チャートに適用します。エンジンは即座に過去のセッションデータの集計を開始し、バックグラウンドにグラデーションマトリックスをマッピングし、画面の指定位置にUIダッシュボードを初期化します。

状態評価(待機フェーズ): オシレーター(RSI)が次足で異常値に到達するために必要な「絶対価格」を常に逆算・評価し、動的なラインとして描画します。価格が市場の構造的インバランス(FVG)の外部にある限り、UIは中立的な「Wait」状態を維持します。

コンフルエンスターゲット(KILLZONEフェーズ): 予測的RSIターゲットと上位足のFVGによる幾何学的な重複(インターセクション)を検知すると、状態は「KILLZONE」へと遷移します。これは高い勝率が見込める平均回帰セットアップの厳格な機械的アラートとして機能します。

期待値(EV)トラッキング: 内蔵のバックテストエンジンは、ターゲットベクターへの過去の到達履歴を、ユーザーが定義したTP(利確)およびSL(損切)パラメーターと照合し、EV%を動的に更新します。この値がプラスであることは、局所的なエッジの数学的証明となります。

構成およびフィルタリングオプション
動的セッションアンカー: 単純な指定バー数のルックバックをバイパスし、配列インデックスベースの処理により特定の時間足(日足や週足のオープン)の切り替わりを正確に検知します。これにより、3Dボリュームプロファイルが実際の機関流動性サイクルと完全に同期します。

ボラティリティ分散エンジン: ボリンジャーバンドとケルトナーチャネルを利用したデュアルスクイーズ検知プロトコルにより、低ボラティリティ環境下でのシグナルをフィルタリングし、TP未達リスクを警告します。
近接スケーラー: ATR乗数を調整することで、コンフルエンスゾーンの論理的な検知範囲を拡大または縮小することが可能です。

システムの技術的限界(達成可能な事項と不可能な事項)
達成可能な事項:
決定論的な価格ターゲティング: ローソク足が確定する前に、モメンタムが反転するために必要な正確な数値閾値を計算し、従来オシレーターの遅行性を排除します。

市場出来高データの視覚的融合: グラデーションプロファイルの奥行きと不透明度は、実際の取引高にプロラタ(比例配分)で連動し、取引密集帯(POC)をシミュレートされた3D空間上に投影します。
クリーンな状態遷移: 相場のフェーズを明確な状態(State)に分類することで、UIを通じて厳格な機械的規律を強制します。

プラットフォームの制限により不可能な事項:
サブミニッツ・ティックデータの取得: TradingViewは、標準のインジケータースクリプトに対してローソク足内部の生ティックデータを提供していません。当エンジンは高度なプロラタ・オーバーラップ・アルゴリズムに依存して各価格帯への出来高分配を推定していますが、これはあくまで数学的な近似値となります。

オブジェクト上限による描画の消去(クリッピング): TradingViewの絶対的な仕様制限により、1つのインジケーターが保持できるオブジェクト数はラベル500個、ボックス500個が上限です。過去のセッション表示数(Number of Historical Profiles)や価格帯の解像度(Row Count)を過剰に高く設定した場合、制限を超えた古い描画オブジェクトから自動消去されます。これはスクリプトの欠陥ではなくプラットフォームの仕様限界です。

アーキテクチャおよび定量的ロジック(技術仕様)
出来高按分エンジン(プロラタ値幅オーバーラップ配分ロジック)
終値に基づく単純な出来高の加算ではなく、各バーの高値・安値レンジと、事前定義された価格帯ビンとの幾何学的な重複を計算し、プロラタ処理を行います。バーの高値を $H$、安値を $L$、出来高を $V$、ビンの上限を BIN\_Top$、下限を BIN\_Bot$ とします。

$H > L$ の場合:
$Overlap = \max(0, \min(H, Bin\_Top) - \max(L, Bin\_Bot))$
$Ratio = \frac{Overlap}{H - L}$
DV = V \times Ratio$

このループを動的アンカー配列全体に対して実行し、クォンツクオリティのマトリックスを生成します。

予測的モメンタムターゲット(代数的反転計算)
エンジンはRMAの数式を代数的に展開し、指定したターゲット(例:70)に到達するために必要な変動幅を導出します。

$Target\_RS = \frac{RSI\_Target}{100.0 - RSI\_Target}$
平滑化ロジックをリバースエンジニアリングすることで、絶対価格座標をロックしチャート上に固定します。

EVシミュレーション状態ロジック
EEV\% = (Win\_Rate \times TP\%) - ((1.0 - Win\_Rate) \times SL\%)$
この離散シミュレーションがバックグラウンドで継続的に実行され、現在のパラメーター構成の統計的妥当性を証明します。
全入力パラメーターの仕様と重大な警告
グループ1 & 2: Timeframe and RSI Core
Macro Timeframe (htf_res): FVG異常検知のアンカーとなる上位足を定義します。

RSI Length / OB / OS: 予測的代数閾値を構成します。
グループ4: Footprint Profile Settings
Profile Anchor Mode (prof_mode): 静的なバー指定と、動的な時間足/セッション配列指定を切り替えます。

Price Row Count (row_count): プロファイルの解像度です。【重大な警告】 解像度(Row Count)を50以上に設定しつつ、同時に過去のセッション表示数(Number of Historical Profiles)を増やした場合、Box配列の生成が指数関数的に増加します。これによりTradingViewのシステム上限である「500個のBox制限」を瞬時に突破し、自動消去(クリッピング)バグが誘発され古いプロファイルが消失します。オブジェクトアロケーションの安全性を確保するため、解像度と履歴の深さは必ずトレードオフのバランスを維持して運用してください。
Versionshinweise
[Important] "Flow & Value" Update (Feature Restriction) & Apology

Thank you for using our indicator. Today, I am writing to sincerely apologize for critical issues found in the core calculation logic of this tool and to announce an emergency update.

■ About the Issues
In the currently published version, two major issues have been identified:

1. Expected Value (EV) Simulator Calculation Discrepancy (Intrabar Evaluation Error)
A fatal discrepancy existed between the internal evaluation logic, TradingView's system specifications, and actual market movements.

Calculation Flaw: The script was designed to check if the "High reached Take Profit (TP)" first, and then check if the "Low reached Stop Loss (SL)" within a single candlestick.

Actual Output Values: For example, in a scenario with an "Entry price of 100, TP of 106, and SL of 97," if the market crashes to hit 97 (SL) first, and then rapidly rebounds to 106 (TP) creating a long wick. In real trading, this is a "Loss (-3%)." However, systematically, because the high condition was evaluated first, it was unconditionally processed as a "Win (+6%)."

Result: Due to this flaw, the win rate and Expected Value (EV) displayed on the dashboard continuously outputted unrealistically high numbers (excellent performance) that could not occur in reality.

2. Severe Performance Lag due to Footprint Feature (Loop Processing Limits)
In the feature that displays past volume as blocks per price level, the data processing volume exceeded the system's limits.

Calculation Flaw: To accurately calculate the volume distribution, the script executed a massive multiple loop process internally: "Number of historical profiles × Number of candles in the period × 24 price level bins."

Actual Error Output: Every time the latest price ticked, thousands to tens of thousands of recalculations occurred, violating Pine Script's strict limit ("a single calculation must finish within approx. 500ms"). This caused the chart to become extremely sluggish or output a "Study Error (execution timeout)," forcefully terminating the indicator's rendering entirely.

■ Emergency Update (Feature Restriction) Implementation
To protect the valuable capital of our users, I determined that the absolute highest priority is to eliminate the risk of inducing "incorrect trading decisions based on inaccurate data."
In today's update, the "EV Simulator" and "Footprint" features have been completely removed.

Moving forward, this script will operate as a "Lightweight Tool Dedicated to Macro Analysis," specializing strictly in Higher Timeframe (HTF) context reading (rendering RSI target lines and FVG zones).

■ Future Actions and Apology
Ideally, all features should have been provided in a perfect state. I deeply apologize for the immense inconvenience caused by my lack of thorough testing. I am truly sorry.

Reflecting on this, and to ensure accuracy within Pine Script's system limits, I will fundamentally split the tool into two separate modules—"Context/Environment Analysis" and "Signal/Verification"—redesigning them as highly precise, dedicated tools for future release.

It pains me to temporarily reduce the functionality, but I will do my utmost to deliver a tool that you can truly trust and use. Thank you for your continued support.


【重要】「Flow & Value」アップデート(機能制限)と謝罪のお知らせ

日頃より当インジケーターをご利用いただき、誠にありがとうございます。
本日は、当ツールの重要な計算ロジックに関するお詫びと、緊急アップデートについてお知らせいたします。

■ 発生していた問題について
現在公開中のバージョンにおいて、以下の2つの重大な問題が確認されました。

1. 期待値(EV)シミュレーターの計算乖離(足内判定のエラー)
内部の判定ロジックにおいて、TradingViewのシステム仕様と実相場の動きに致命的なズレが生じていました。

計算の欠陥: 当スクリプトは1本のローソク足の中で「高値が利確(TP)に到達したか」を先に計算し、その後に「安値が損切り(SL)に到達したか」を判定する仕様になっていました。

実際に出力されていた値: 例えば「エントリー価格100円、利確106円、損切97円」の場面で、相場が先に暴落して97円(損切り)に触れた後、急反発して106円(利確)に到達する長いヒゲのローソク足が発生したとします。現実のトレードでは「負け(-3%)」ですが、システム上は高値の条件を先に読み込むため、無条件で「勝ち(+6%)」として処理されていました。

結果: これにより、ダッシュボード上の勝率および期待値(EV)が、現実ではあり得ないほど高い数値(優秀な成績)として出力され続ける状態になっておりました。

2. Footprint機能による著しい動作遅延(ループ処理の限界)
過去の出来高を価格帯ごとにブロック表示する機能において、処理データ量がシステムの限界値を突破しておりました。

計算の欠陥: 出来高の分布を正確に計算するため、「過去のプロファイル数 × 期間内のローソク足本数 × 24分割した価格帯」という多重ループ処理を内部で実行していました。

実際に出力されていたエラー: 最新の価格が1ティック動くたびに数千から数万回の再計算が発生し、Pine Scriptの「1回の計算を一定時間内(約500ミリ秒)に終わらせなければならない」という厳格な上限に抵触していました。これにより、チャートの表示が極端に重くなる、または「Study Error(処理タイムアウト)」というエラーが出力され、インジケーターの描画そのものが強制終了する現象が発生しておりました。

■ 緊急アップデート(機能制限)の実施
ユーザーの皆様の大切な資金を守るため、「不正確なデータによる誤ったトレード判断」を誘発するリスクを最優先で排除すべきと判断いたしました。
本日付のアップデートにて、「EVシミュレーター」および「Footprint」機能を完全に削除いたしました。

今後は、上位足の環境認識(RSIターゲットラインとFVGゾーンの描画)に特化した「マクロ分析専用の軽量版ツール」として動作します。

■ 今後の対応と謝罪
本来であれば、すべての機能を完璧な状態でご提供すべきところ、私の検証不足により、皆様に多大なご迷惑をおかけしましたことを深くお詫び申し上げます。本当に申し訳ございませんでした。

今回の反省を踏まえ、Pine Scriptのシステム制限の中で正確性を担保するため、今後は「環境認識用」と「シグナル・検証用」でツールを根本から分割し、より精密な専用ツールとして再設計を進めてまいります。
一時的な機能縮小となり大変心苦しいですが、皆様に「本当に信頼して使えるツール」をお届けできるよう全力を尽くします。今後とも何卒よろしくお願い申し上げます。

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.