OPEN-SOURCE SCRIPT
تم تحديثه Texas Hold'em Engine [BOX Max Size Edition]

Texas Hold'em [BOX Max Size Edition]
NOTICE / DISCLAIMER
This architecture is NOT a mere entertainment tool. It is a highly advanced algorithmic multi-state logic simulation engine disguised as a Texas Hold'em framework, specifically designed to test the computational overhead, state persistence, and localized rendering boundaries of Pine Script v6 under live tick conditions.
EXECUTIVE SUMMARY
This script is deployed as a Proof of Concept (PoC) to demonstrate the extreme limits of Pine Script v6's array processing, state evaluation capabilities, and localized UI rendering. It functions as a rigorous technical benchmark for developers building institutional-grade algorithmic dashboards directly on TradingView charts. By leveraging box.new() structures, this script successfully bypasses TradingView's native text scaling limits, allowing for massive UI components that seamlessly track price volatility.
SYSTEM USAGE (How-To / Interactive Execution Flow)
Initialization: Apply the script to a chart. The system automatically initializes a deterministic pseudo-random array shuffle based on the Game Seed.
Phase Progression: The script executes across 6 distinct phases based on the bar index: Dealing, Pre-Flop, Flop, Turn, River, and Showdown.
Player Action Inputs: Using the Settings menu, manually override your decisions (FOLD, CALL/CHECK, RAISE) during the Pre-Flop, Flop, Turn, and River phases.
CPU State Engine: The opposing CPU evaluates the market's volatility via the True Range (ATR). If ta.tr / ta.sma(ta.tr, 14) > 1.5, the CPU assumes an aggressive posture and executes a "RAISE".
Stateful Transaction Engine: As actions are selected, the system calculates blind deductions, raise accumulations, and pot sizes. The var driven memory engine perfectly retains chip stack data across chart ticks and resets seamlessly upon determining a winner via Fold or Showdown.
Evaluation: At the Showdown phase, a localized combinatorics engine processes a 7-card array for both entities, scoring the best 5-card combinations using mathematical rank arrays to determine the victor and award the accumulated pot.
ARCHITECTURE & QUANTITATIVE LOGIC (Technical Specifications)
Bounding Box Scaling Algorithm (Localized UI Vector Scaling)
Standard label.new() text strings are hard-capped at size.huge (approx. 36px), which fails to scale alongside chart zooming. To override this limitation, vector Unicode strings are injected into a box.new() container. The Y-axis boundaries are mathematically locked to the Average True Range (ATR).
Formula:
Top = Y_Position + (ATR / 2)
Bottom = Y_Position - (ATR / 2)
Calculation Example:
Given an asset trading at Y = 150.00 with an ATR = 2.0.
Top = 150.00 + (2.0 / 2) = 151.00
Bottom = 150.00 - (2.0 / 2) = 149.00
The resulting Y-axis width of the box is strictly 2.0. By enforcing a strict volatility-based bounding box, the text engine is overridden, forcing the Unicode vectors to dynamically scale in perfect proportion to market noise.
Persistent State Memory (Transaction Logic)
TradingView charts inherently recalculate scripts on every new price tick. To prevent the chip stacks and pot sizes from resetting, the system employs Pine Script's var declaration alongside a custom last_calc_state tracker. This ensures that deductions and additions are mathematically locked only once per phase transition, proving that complex financial state machines can run cleanly alongside heavy visual rendering without consuming object limit quotas.
Deterministic Pseudo-Random Array Shuffling (LCG Implementation)
To eliminate chart repainting across continuous tick streaming, a Linear Congruential Generator (LCG) loop reorganizes the 52-element primary array via modulo arithmetic:
Swap_Index = (Seed + i * 7) % (i + 1)
This math guarantees identical randomizations across every chart tick refresh, achieving absolute visual stability.
INPUT PARAMETERS REFERENCE
Chip & Betting System: Configure initial starting stacks, blind amounts, and default raise sizes.
UI Mode: Toggles between a static Table grid and the dynamic Chart-Linked Box rendering.
Force Enlarge Cards with Box Text: Activates the bounding box algorithm mentioned above.
Y-Axis Reference Price: Anchors the floating UI to High, Low, or Close prices to prevent visual collision with candlestick series.
テキサスホールデム [BOX Max Size Edition]
免責事項
本アーキテクチャは単なる娯楽ツールではありません。これは、テキサスホールデムのフレームワークを模した、高度な多状態ロジックシミュレーションエンジンであり、Pine Script v6におけるライブティック更新下の計算オーバーヘッド、状態変数の永続性(メモリ保持)、および局所的レンダリングの限界を検証するために特別に設計されています。
エグゼクティブ・サマリー
本スクリプトは、Pine Script v6の配列処理、状態評価、およびUI描画の極限を実証するための概念実証(PoC)モデルです。TradingView上でクォンツレベルのアルゴリズム・ダッシュボードを構築する開発者に向けた技術的ベンチマークとして機能します。box.new()構造体を応用することで、TradingViewネイティブのテキスト縮尺制限を突破し、ボラティリティに追従する巨大なUIコンポーネントの描画を実現しています。
システム実行手順(インタラクティブ実行フローの詳細)
初期化: スクリプトをチャートに適用すると、Game Seedに基づく決定論的疑似乱数アルゴリズムにより、配列のシャッフルが初期化されます。
フェーズ進行: バーインデックスに基づき、Dealing、Pre-Flop、Flop、Turn、River、Showdownの6つのフェーズが自動進行します。
プレイヤーアクション: 設定画面のプルダウンから、各フェーズ(Pre-Flop〜River)における自身のアクション(FOLD, CALL/CHECK, RAISE)を手動でオーバーライドします。
CPU状態エンジン: 対面(CPU)は、True Range (ATR)を用いて市場のボラティリティを評価します。ta.tr / ta.sma(ta.tr, 14) > 1.5の場合、CPUはアグレッシブな状態と判断し「RAISE」を実行します。
状態記憶トランザクションエンジン: アクションが選択されると、システムはブラインドの徴収、レイズによる資金移動、POTの合計を瞬時に計算します。var変数で構築されたメモリエンジンにより、ティックが更新されてもチップスタックは完璧に保持され、勝敗確定時に正確に清算されます。
役の評価: Showdownフェーズにて、ローカルの組み合わせ評価エンジンが双方の7要素配列を処理し、ランク配列を用いて最適な5枚の組み合わせをスコアリングし、勝敗の決定とPOTの分配を行います。
アーキテクチャおよび定量的ロジック(技術仕様)
Bounding Boxスケーリング・アルゴリズム(局所的UIベクタースケーリング)
標準の label.new() オブジェクトは最大フォントサイズが size.huge(約36px)に制限されており、チャートの拡大縮小に追従しません。この制限をオーバーライドするため、ベクターテキストを box.new() 構造体に注入し、Y軸の境界をAverage True Range (ATR)に同期させます。
計算式:
Top = Y座標 + (ATR / 2)
Bottom = Y座標 - (ATR / 2)
実際の計算例:
現在価格 Y = 150.00、ATR = 2.0 の資産の場合。
Top = 150.00 + (2.0 / 2) = 151.00
Bottom = 150.00 - (2.0 / 2) = 149.00
出力されるBoxのY軸幅は正確に 2.0 となります。価格変動(ボラティリティ)に基づく厳格な境界ボックスを強制することで内部レンダリングエンジンをハックし、市場のノイズに完全に比例したダイナミックなテキストスケーリングを実現しています。
永続的状態メモリ(トランザクションロジック)
TradingViewのチャートは、価格ティックが動くたびにスクリプト全体を再計算します。この挙動によってチップスタックやPOTがリセットされるのを防ぐため、Pine Scriptの var 宣言と独自の last_calc_state トラッカーを組み合わせています。これにより、各フェーズの移行時に一度だけ確実な資金移動計算がロックされます。これは、高度な描画処理と並行して、複雑な金融ステートマシンが制限オブジェクト(BoxやLabel)を消費することなくクリーンに動作することを証明しています。
]
決定論的疑似乱数による配列シャッフル(LCGの実装)
ティック更新におけるリペイントを防ぐため、剰余演算を用いた線形合同法(LCG)アルゴリズムが52要素のプライマリ配列を並び替えます。
Swap_Index = (Seed + i * 7) % (i + 1)
この数理モデルにより、すべてのティック再計算において完全に同一の配列並び順が維持されます。
主要入力パラメーター仕様
Chip & Betting System: 初期スタック量、ブラインド額、デフォルトのレイズ額を設定します。
UI Mode: 固定テーブル描画と、チャート連動型のBOX描画を切り替えます。
Force Enlarge Cards with Box Text: 上記のバウンディングボックス・アルゴリズムを有効化します。
Y-Axis Reference Price: ローソク足との視覚的な衝突を避けるため、フローティングUIの基準アンカーをHigh, Low, Closeのいずれかに固定します。
NOTICE / DISCLAIMER
This architecture is NOT a mere entertainment tool. It is a highly advanced algorithmic multi-state logic simulation engine disguised as a Texas Hold'em framework, specifically designed to test the computational overhead, state persistence, and localized rendering boundaries of Pine Script v6 under live tick conditions.
EXECUTIVE SUMMARY
This script is deployed as a Proof of Concept (PoC) to demonstrate the extreme limits of Pine Script v6's array processing, state evaluation capabilities, and localized UI rendering. It functions as a rigorous technical benchmark for developers building institutional-grade algorithmic dashboards directly on TradingView charts. By leveraging box.new() structures, this script successfully bypasses TradingView's native text scaling limits, allowing for massive UI components that seamlessly track price volatility.
SYSTEM USAGE (How-To / Interactive Execution Flow)
Initialization: Apply the script to a chart. The system automatically initializes a deterministic pseudo-random array shuffle based on the Game Seed.
Phase Progression: The script executes across 6 distinct phases based on the bar index: Dealing, Pre-Flop, Flop, Turn, River, and Showdown.
Player Action Inputs: Using the Settings menu, manually override your decisions (FOLD, CALL/CHECK, RAISE) during the Pre-Flop, Flop, Turn, and River phases.
CPU State Engine: The opposing CPU evaluates the market's volatility via the True Range (ATR). If ta.tr / ta.sma(ta.tr, 14) > 1.5, the CPU assumes an aggressive posture and executes a "RAISE".
Stateful Transaction Engine: As actions are selected, the system calculates blind deductions, raise accumulations, and pot sizes. The var driven memory engine perfectly retains chip stack data across chart ticks and resets seamlessly upon determining a winner via Fold or Showdown.
Evaluation: At the Showdown phase, a localized combinatorics engine processes a 7-card array for both entities, scoring the best 5-card combinations using mathematical rank arrays to determine the victor and award the accumulated pot.
ARCHITECTURE & QUANTITATIVE LOGIC (Technical Specifications)
Bounding Box Scaling Algorithm (Localized UI Vector Scaling)
Standard label.new() text strings are hard-capped at size.huge (approx. 36px), which fails to scale alongside chart zooming. To override this limitation, vector Unicode strings are injected into a box.new() container. The Y-axis boundaries are mathematically locked to the Average True Range (ATR).
Formula:
Top = Y_Position + (ATR / 2)
Bottom = Y_Position - (ATR / 2)
Calculation Example:
Given an asset trading at Y = 150.00 with an ATR = 2.0.
Top = 150.00 + (2.0 / 2) = 151.00
Bottom = 150.00 - (2.0 / 2) = 149.00
The resulting Y-axis width of the box is strictly 2.0. By enforcing a strict volatility-based bounding box, the text engine is overridden, forcing the Unicode vectors to dynamically scale in perfect proportion to market noise.
Persistent State Memory (Transaction Logic)
TradingView charts inherently recalculate scripts on every new price tick. To prevent the chip stacks and pot sizes from resetting, the system employs Pine Script's var declaration alongside a custom last_calc_state tracker. This ensures that deductions and additions are mathematically locked only once per phase transition, proving that complex financial state machines can run cleanly alongside heavy visual rendering without consuming object limit quotas.
Deterministic Pseudo-Random Array Shuffling (LCG Implementation)
To eliminate chart repainting across continuous tick streaming, a Linear Congruential Generator (LCG) loop reorganizes the 52-element primary array via modulo arithmetic:
Swap_Index = (Seed + i * 7) % (i + 1)
This math guarantees identical randomizations across every chart tick refresh, achieving absolute visual stability.
INPUT PARAMETERS REFERENCE
Chip & Betting System: Configure initial starting stacks, blind amounts, and default raise sizes.
UI Mode: Toggles between a static Table grid and the dynamic Chart-Linked Box rendering.
Force Enlarge Cards with Box Text: Activates the bounding box algorithm mentioned above.
Y-Axis Reference Price: Anchors the floating UI to High, Low, or Close prices to prevent visual collision with candlestick series.
テキサスホールデム [BOX Max Size Edition]
免責事項
本アーキテクチャは単なる娯楽ツールではありません。これは、テキサスホールデムのフレームワークを模した、高度な多状態ロジックシミュレーションエンジンであり、Pine Script v6におけるライブティック更新下の計算オーバーヘッド、状態変数の永続性(メモリ保持)、および局所的レンダリングの限界を検証するために特別に設計されています。
エグゼクティブ・サマリー
本スクリプトは、Pine Script v6の配列処理、状態評価、およびUI描画の極限を実証するための概念実証(PoC)モデルです。TradingView上でクォンツレベルのアルゴリズム・ダッシュボードを構築する開発者に向けた技術的ベンチマークとして機能します。box.new()構造体を応用することで、TradingViewネイティブのテキスト縮尺制限を突破し、ボラティリティに追従する巨大なUIコンポーネントの描画を実現しています。
システム実行手順(インタラクティブ実行フローの詳細)
初期化: スクリプトをチャートに適用すると、Game Seedに基づく決定論的疑似乱数アルゴリズムにより、配列のシャッフルが初期化されます。
フェーズ進行: バーインデックスに基づき、Dealing、Pre-Flop、Flop、Turn、River、Showdownの6つのフェーズが自動進行します。
プレイヤーアクション: 設定画面のプルダウンから、各フェーズ(Pre-Flop〜River)における自身のアクション(FOLD, CALL/CHECK, RAISE)を手動でオーバーライドします。
CPU状態エンジン: 対面(CPU)は、True Range (ATR)を用いて市場のボラティリティを評価します。ta.tr / ta.sma(ta.tr, 14) > 1.5の場合、CPUはアグレッシブな状態と判断し「RAISE」を実行します。
状態記憶トランザクションエンジン: アクションが選択されると、システムはブラインドの徴収、レイズによる資金移動、POTの合計を瞬時に計算します。var変数で構築されたメモリエンジンにより、ティックが更新されてもチップスタックは完璧に保持され、勝敗確定時に正確に清算されます。
役の評価: Showdownフェーズにて、ローカルの組み合わせ評価エンジンが双方の7要素配列を処理し、ランク配列を用いて最適な5枚の組み合わせをスコアリングし、勝敗の決定とPOTの分配を行います。
アーキテクチャおよび定量的ロジック(技術仕様)
Bounding Boxスケーリング・アルゴリズム(局所的UIベクタースケーリング)
標準の label.new() オブジェクトは最大フォントサイズが size.huge(約36px)に制限されており、チャートの拡大縮小に追従しません。この制限をオーバーライドするため、ベクターテキストを box.new() 構造体に注入し、Y軸の境界をAverage True Range (ATR)に同期させます。
計算式:
Top = Y座標 + (ATR / 2)
Bottom = Y座標 - (ATR / 2)
実際の計算例:
現在価格 Y = 150.00、ATR = 2.0 の資産の場合。
Top = 150.00 + (2.0 / 2) = 151.00
Bottom = 150.00 - (2.0 / 2) = 149.00
出力されるBoxのY軸幅は正確に 2.0 となります。価格変動(ボラティリティ)に基づく厳格な境界ボックスを強制することで内部レンダリングエンジンをハックし、市場のノイズに完全に比例したダイナミックなテキストスケーリングを実現しています。
永続的状態メモリ(トランザクションロジック)
TradingViewのチャートは、価格ティックが動くたびにスクリプト全体を再計算します。この挙動によってチップスタックやPOTがリセットされるのを防ぐため、Pine Scriptの var 宣言と独自の last_calc_state トラッカーを組み合わせています。これにより、各フェーズの移行時に一度だけ確実な資金移動計算がロックされます。これは、高度な描画処理と並行して、複雑な金融ステートマシンが制限オブジェクト(BoxやLabel)を消費することなくクリーンに動作することを証明しています。
]
決定論的疑似乱数による配列シャッフル(LCGの実装)
ティック更新におけるリペイントを防ぐため、剰余演算を用いた線形合同法(LCG)アルゴリズムが52要素のプライマリ配列を並び替えます。
Swap_Index = (Seed + i * 7) % (i + 1)
この数理モデルにより、すべてのティック再計算において完全に同一の配列並び順が維持されます。
主要入力パラメーター仕様
Chip & Betting System: 初期スタック量、ブラインド額、デフォルトのレイズ額を設定します。
UI Mode: 固定テーブル描画と、チャート連動型のBOX描画を切り替えます。
Force Enlarge Cards with Box Text: 上記のバウンディングボックス・アルゴリズムを有効化します。
Y-Axis Reference Price: ローソク足との視覚的な衝突を避けるため、フローティングUIの基準アンカーをHigh, Low, Closeのいずれかに固定します。
ملاحظات الأخبار
[DEPRECATED] Texas Hold'em Engine [BOX Max Size Edition]【Update / Notice】
Thank you for using this script.
To focus my resources on the research and development of more practical market analysis tools and technical indicators, I have decided to end support and feature updates for this script.
Moving forward, I will dedicate my efforts to publishing highly practical indicators. Thank you for your continued support.
ملاحظات الأخبار
[Development Resumed & Update Notice]In response to recent community boosts and engagement, development and support for this script have been officially resumed.
This update introduces a comprehensive refactoring of the core engine, turning it into a fully functional implementation sample for state-machine and UI rendering in Pine Script v6.
Key Improvements:
1. Core Logic Refactoring
- Transitioned transaction and state calculations to execute across all historical bars, ensuring chip histories persist accurately upon indicator reloads or timeframe changes.
2. Bug Fixes
- Resolved an issue where additional bets were incorrectly deducted during remaining phases after a fold action had occurred.
3. New Feature
- Auto-Reload System: Automatically replenishes the stack to the default "Starting Stack" at the beginning of a new cycle if the remaining chips fall below the Big Blind (BB) amount.
ملاحظات الأخبار
Updated the script so you can now play the game completely without errors!ملاحظات الأخبار
How to Play: 3D Texas Hold'em1. Initialization
Open the indicator settings.
Check the ▶️ START GAME box to initialize the engine.
2. Game Progression
The game proceeds through four strict phases: 1. Pre-Flop, 2. Flop, 3. Turn, and 4. River.
During each phase, select exactly ONE action in the settings menu: WAIT, FOLD, CALL, or RAISE.
CRITICAL REQUIREMENT: You must input actions in sequential order. Selecting multiple actions in a single phase or skipping a prior phase will trigger a mandatory system error lock.
3. Showdown & Results
Once the River phase action is submitted, or if either player selects FOLD, the game automatically evaluates the hands.
The winner, hand rank, and chip balance updates are displayed on the 3D chart interface.
4. Starting a New Hand
Uncheck ALL action boxes from the completed hand.
Increase the Game ID value by 1 to reset the memory engine, clear the board, and draw a new set of cards.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
Script Developer.
I specialize in pushing basic, fundamental concepts to their absolute limits. Dedicated to engineering noise-free indicators that reveal true market mechanics and logical edges. Clarity over https://clutter.https://www.youtube.com/@alt.analyst
I specialize in pushing basic, fundamental concepts to their absolute limits. Dedicated to engineering noise-free indicators that reveal true market mechanics and logical edges. Clarity over https://clutter.https://www.youtube.com/@alt.analyst
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
Script Developer.
I specialize in pushing basic, fundamental concepts to their absolute limits. Dedicated to engineering noise-free indicators that reveal true market mechanics and logical edges. Clarity over https://clutter.https://www.youtube.com/@alt.analyst
I specialize in pushing basic, fundamental concepts to their absolute limits. Dedicated to engineering noise-free indicators that reveal true market mechanics and logical edges. Clarity over https://clutter.https://www.youtube.com/@alt.analyst
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.