# mrdungx2603/tradingview-pine-scripts architecture

> Architecture diagram of the GitHub repository mrdungx2603/tradingview-pine-scripts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrdungx2603/tradingview-pine-scripts
- Repository: https://github.com/mrdungx2603/tradingview-pine-scripts

## Overview

TV Pine is a TradingView Pine Script toolkit for technical indicators and trading strategies, with shared Pine libraries, research backtests, and a separate SMC dashboard. The main user workflow is to select or develop a Pine indicator/strategy, use it on TradingView, and evaluate strategy ideas with backtests; the dashboard separately loads market candles, computes SMC structure, and presents charts and statistics. The graph also preserves the market-profile and order-flow branches. Relationships among unsampled Pine scripts are limited to documented capabilities; the source excerpts primarily establish the dashboard and selected backtest wiring.

Main entry points: [`python/app.py`](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/app.py) (Dash Application), [`backtests/va_rule/va_rule_backtest.py`](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/va_rule/va_rule_backtest.py) (Value Area Backtest), [`python/smc_engine.py`](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/smc_engine.py) (SMC Engine), [`indicators`](https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/indicators) (Technical Indicators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pine["Pine Trading"]
  node_indicators["Technical Indicators"]
  node_smc_indicator["SMC Structure"]
  node_market_profile["Market Profile"]
  node_order_flow["Order Flow Tools"]
  node_other_indicators["Other Indicators"]
  node_strategies["Trading Strategies<br/>[smc_strategy.pine]"]
end

subgraph group_shared["Pine Libraries"]
  node_smc_lib["SMC Core<br/>[smc_core.pine]"]
  node_profile_lib["Market Profile Core"]
  node_orderflow_lib["Order Flow Core"]
end

subgraph group_research["Backtest Research"]
  node_backtest_runner["Strategy Backtests"]
  node_profile_backtest["Value Area Backtest"]
  node_backtest_data["Backtest Data Loader<br/>[data.py]"]
  node_profile_calc["Profile Calculator<br/>[market_profile.py]"]
  node_results["Research Results"]
end

subgraph group_dashboard["SMC Dashboard"]
  node_dash_app["Dash Application<br/>[app.py]"]
  node_controls["Chart Controls<br/>[controls.py]"]
  node_db_layer["Candle Queries<br/>[db.py]"]
  node_smc_engine["SMC Engine<br/>[smc_engine.py]"]
  node_chart["Chart Renderer<br/>[chart_view.py]"]
  node_stats["Statistics Panel<br/>[stats_panel.py]"]
end

subgraph group_data["Market Data"]
  node_market_db[("Market Data DB")]
end

node_trader(("Trader / Developer"))
node_tradingview["TradingView"]
node_dashboard_user(("Dashboard User"))

node_trader -->|"develops or selects"| node_indicators
node_trader -->|"develops or selects"| node_strategies
node_indicators -->|"runs on"| node_tradingview
node_strategies -->|"runs on"| node_tradingview
node_smc_indicator -.->|"uses core"| node_smc_lib
node_market_profile -->|"uses core"| node_profile_lib
node_order_flow -.->|"uses core"| node_orderflow_lib
node_trader -->|"runs research"| node_backtest_runner
node_trader -->|"runs research"| node_profile_backtest
node_backtest_runner -->|"writes results"| node_results
node_profile_backtest -->|"loads candles"| node_backtest_data
node_profile_backtest -->|"builds profiles"| node_profile_calc
node_backtest_data -->|"queries candles"| node_market_db
node_profile_backtest -.->|"writes results"| node_results
node_dashboard_user -->|"uses dashboard"| node_dash_app
node_dash_app -->|"renders controls"| node_controls
node_dash_app -->|"queries data"| node_db_layer
node_db_layer -->|"queries candles"| node_market_db
node_dash_app -->|"computes structure"| node_smc_engine
node_dash_app -->|"builds chart"| node_chart
node_dash_app -->|"builds statistics"| node_stats
node_chart -->|"renders results"| node_smc_engine
node_stats -->|"summarizes results"| node_smc_engine

click node_indicators "https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/indicators"
click node_smc_indicator "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/indicators/smc_market_structure.pine"
click node_market_profile "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/indicators/market_profile.pine"
click node_order_flow "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/indicators/order_flow_bar.pine"
click node_other_indicators "https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/indicators"
click node_strategies "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/strategies/smc_strategy.pine"
click node_smc_lib "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/libraries/smc_core.pine"
click node_profile_lib "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/libraries/market_profile_core.pine"
click node_orderflow_lib "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/libraries/order_flow_core.pine"
click node_backtest_runner "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/smc_123/smc_123_backtest.mjs"
click node_profile_backtest "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/va_rule/va_rule_backtest.py"
click node_backtest_data "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/common/data.py"
click node_profile_calc "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/common/market_profile.py"
click node_results "https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/backtests"
click node_dash_app "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/app.py"
click node_controls "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/components/controls.py"
click node_db_layer "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/db.py"
click node_smc_engine "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/smc_engine.py"
click node_chart "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/components/chart_view.py"
click node_stats "https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/components/stats_panel.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_indicators,node_smc_indicator,node_market_profile,node_order_flow,node_other_indicators,node_strategies,node_tradingview,node_dashboard_user toneBlue
class node_smc_lib,node_profile_lib,node_orderflow_lib toneAmber
class node_backtest_runner,node_profile_backtest,node_backtest_data,node_profile_calc,node_results toneMint
class node_dash_app,node_controls,node_db_layer,node_smc_engine,node_chart,node_stats toneRose
class node_market_db,node_trader toneIndigo
```

## Components

### Pine Trading

- [Technical Indicators](https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/indicators): `indicators`
- [SMC Structure](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/indicators/smc_market_structure.pine): `indicators/smc_market_structure.pine`
- [Market Profile](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/indicators/market_profile.pine): `indicators/market_profile.pine`
- [Order Flow Tools](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/indicators/order_flow_bar.pine): `indicators/order_flow_bar.pine`
- [Other Indicators](https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/indicators): `indicators`
- [Trading Strategies](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/strategies/smc_strategy.pine): `strategies/smc_strategy.pine`

### Pine Libraries

- [SMC Core](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/libraries/smc_core.pine): `libraries/smc_core.pine`
- [Market Profile Core](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/libraries/market_profile_core.pine): `libraries/market_profile_core.pine`
- [Order Flow Core](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/libraries/order_flow_core.pine): `libraries/order_flow_core.pine`

### Backtest Research

- [Strategy Backtests](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/smc_123/smc_123_backtest.mjs): `backtests/smc_123/smc_123_backtest.mjs`
- [Value Area Backtest](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/va_rule/va_rule_backtest.py): `backtests/va_rule/va_rule_backtest.py`
- [Backtest Data Loader](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/common/data.py): `backtests/common/data.py`
- [Profile Calculator](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/backtests/common/market_profile.py): `backtests/common/market_profile.py`
- [Research Results](https://github.com/mrdungx2603/tradingview-pine-scripts/tree/master/backtests): `backtests`

### SMC Dashboard

- [Dash Application](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/app.py): `python/app.py`
- [Chart Controls](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/components/controls.py): `python/components/controls.py`
- [Candle Queries](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/db.py): `python/db.py`
- [SMC Engine](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/smc_engine.py): `python/smc_engine.py`
- [Chart Renderer](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/components/chart_view.py): `python/components/chart_view.py`
- [Statistics Panel](https://github.com/mrdungx2603/tradingview-pine-scripts/blob/master/python/components/stats_panel.py): `python/components/stats_panel.py`

### Market Data

- **Market Data DB**

### Other components

- **Trader / Developer**
- **TradingView**
- **Dashboard User**

## Connections

- Trader / Developer → Technical Indicators: develops or selects (evidence: `README.md`)
- Trader / Developer → Trading Strategies: develops or selects (evidence: `README.md`)
- Technical Indicators → TradingView: runs on (evidence: `README.md`)
- Trading Strategies → TradingView: runs on (evidence: `README.md`)
- SMC Structure → SMC Core: uses core
- Market Profile → Market Profile Core: uses core
- Order Flow Tools → Order Flow Core: uses core
- Trader / Developer → Strategy Backtests: runs research (evidence: `README.md`)
- Trader / Developer → Value Area Backtest: runs research (evidence: `README.md`)
- Strategy Backtests → Research Results: writes results (evidence: `backtests/smc_123/smc_123_backtest.mjs`)
- Value Area Backtest → Backtest Data Loader: loads candles (evidence: `backtests/va_rule/va_rule_backtest.py`)
- Value Area Backtest → Profile Calculator: builds profiles (evidence: `backtests/va_rule/va_rule_backtest.py`)
- Backtest Data Loader → Market Data DB: queries candles (evidence: `backtests/common/data.py`)
- Value Area Backtest → Research Results: writes results (evidence: `backtests/va_rule/va_rule_backtest.py`)
- Dashboard User → Dash Application: uses dashboard (evidence: `python/app.py`)
- Dash Application → Chart Controls: renders controls (evidence: `python/app.py`)
- Dash Application → Candle Queries: queries data (evidence: `python/app.py`)
- Candle Queries → Market Data DB: queries candles (evidence: `python/db.py`)
- Dash Application → SMC Engine: computes structure (evidence: `python/app.py`)
- Dash Application → Chart Renderer: builds chart (evidence: `python/app.py`)
- Dash Application → Statistics Panel: builds statistics (evidence: `python/app.py`)
- Chart Renderer → SMC Engine: renders results (evidence: `python/components/chart_view.py`)
- Statistics Panel → SMC Engine: summarizes results (evidence: `python/components/stats_panel.py`)
