# ykunakorn/tradingview-indicator architecture

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

- Interactive diagram: https://gitdiagram.com/ykunakorn/tradingview-indicator
- Repository: https://github.com/ykunakorn/tradingview-indicator

## Overview

1. **Repository purpose**
   - This repo is a small collection of **TradingView Pine Script indicators**, centered on a custom **3-candlestick pattern detector** and related technical-analysis overlays.

2. **Execution boundary**
   - There is **no server-side architecture** here.
   - All logic runs **inside TradingView’s Pine Script runtime** on the chart, using the platform’s built-in market data and indicator APIs.

3. **Main artifacts**
   - `3candlesticks.pine` appears to be the primary script for the multi-candle pattern indicator.
   - `WindsurfEMA.pine` is likely a separate EMA-based indicator.
   - `essentian_indicator.pine` is another standalone indicator script, probably a companion or variant.
   - The scripts are best treated as **independent modules**, not as a compiled application with shared runtime state.

4. **Primary data flow**
   - Input: OHLCV bar data from the currently loaded TradingView symbol/timeframe.
   - Processing: Pine Script logic evaluates candlestick relationships, indicator conditions, and thresholds.
   - Output: visual markers, highlights, plotted lines/shapes, and possibly alerts on the chart.

5. **Core functional subsystem**
   - The central subsystem is **pattern detection** for 3-candle setups such as Morning Star / Evening Star-style formations.
   - This subsystem likely computes candle body/wick relationships and validates conditions across consecutive bars.

6. **Visualization subsystem**
   - Signals are rendered directly on the chart, which is the main user-facing output.
   - Typical outputs in Pine indicators are shapes, labels, colored bars/backgrounds, and plotted series; this repo is built around that chart-overlay model.

7. **Configuration boundary**
   - The indicator is intended to expose **input parameters** so traders can tune detection sensitivity and visual behavior.
   - In architecture terms, these inputs are the only “configuration layer”; there is no external config service or persistence layer.

8. **Likely supporting indicator logic**
   - The presence of `WindsurfEMA.pine` suggests an **EMA trend filter or smoothing component** may be used either as a standalone tool or as a companion signal layer.
   - `essentian_indicator.pine` suggests additional signal logic or a more general-purpose indicator variant, but still within the same Pine-script/chart-overlay architecture.

9. **External dependencies**
   - The only meaningful external dependency is **TradingView** itself: Pine editor, chart engine, and optionally TradingView alerts.
   - No databases, APIs, message queues, or deployment infrastructure are present in the repository.

10. **Repo/documentation mismatch**
   - The README refers to `indicator.pine`, but that file is not in the tree.
   - For diagramming purposes, treat `3candlesticks.pine` as the primary implementation unless the missing file exists elsewhere.

11. **How to diagram it**
   - Draw a single boundary labeled **TradingView / Pine Script runtime**.
   - Inside it, show separate indicator scripts fed by **market price bars**.
   - Show the main 3-candle detector producing **chart signals**, with optional companion indicator scripts (EMA / essential indicator) as parallel modules.

Main entry points: [`3candlesticks.pine`](https://github.com/ykunakorn/tradingview-indicator/blob/main/3candlesticks.pine) (3 Candles), [`essentian_indicator.pine`](https://github.com/ykunakorn/tradingview-indicator/blob/main/essentian_indicator.pine) (Essential Indicator), [`WindsurfEMA.pine`](https://github.com/ykunakorn/tradingview-indicator/blob/main/WindsurfEMA.pine) (Windsurf EMA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["TradingView / Pine Script runtime"]
  node_candles["3 Candles<br/>pattern detector<br/>[3candlesticks.pine]"]
  node_ema["Windsurf EMA<br/>trend filter<br/>[WindsurfEMA.pine]"]
  node_essential["Essential Indicator<br/>signal indicator"]
  node_inputs["Inputs<br/>indicator settings"]
  node_chart_signals(("Chart signals<br/>visual output"))
  node_alerts{{"Alerts<br/>notification output"}}
end

node_market_data[("Market bars<br/>ohlcv feed")]

node_market_data -->|"bars"| node_candles
node_market_data -->|"bars"| node_ema
node_market_data -->|"bars"| node_essential
node_inputs -->|"tune"| node_candles
node_inputs -->|"tune"| node_ema
node_inputs -->|"tune"| node_essential
node_candles -->|"render"| node_chart_signals
node_candles -->|"signal"| node_alerts
node_ema -->|"render"| node_chart_signals
node_essential -->|"render"| node_chart_signals
node_essential -->|"signal"| node_alerts

click node_candles "https://github.com/ykunakorn/tradingview-indicator/blob/main/3candlesticks.pine"
click node_ema "https://github.com/ykunakorn/tradingview-indicator/blob/main/WindsurfEMA.pine"
click node_essential "https://github.com/ykunakorn/tradingview-indicator/blob/main/essentian_indicator.pine"

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_candles,node_ema,node_essential,node_inputs,node_chart_signals,node_alerts toneBlue
class node_market_data toneNeutral
```

## Components

### TradingView / Pine Script runtime

Chart-side execution boundary for all indicator scripts

- [3 Candles](https://github.com/ykunakorn/tradingview-indicator/blob/main/3candlesticks.pine): pattern detector · Primary multi-candle pattern detector for Morning Star / Evening Star-style setups · `3candlesticks.pine`
- [Windsurf EMA](https://github.com/ykunakorn/tradingview-indicator/blob/main/WindsurfEMA.pine): trend filter · Standalone EMA-based indicator or companion trend overlay · `WindsurfEMA.pine`
- [Essential Indicator](https://github.com/ykunakorn/tradingview-indicator/blob/main/essentian_indicator.pine): signal indicator · Additional standalone Pine indicator script · `essentian_indicator.pine`
- **Inputs**: indicator settings · Trader-tuned sensitivity and display parameters exposed by Pine inputs
- **Chart signals**: visual output · Shapes, labels, plots, bar colors, and highlights drawn on the chart
- **Alerts**: notification output · Optional TradingView alerts derived from indicator conditions

### Other components

- **Market bars**: ohlcv feed · Current symbol/timeframe price bars from TradingView

## Connections

- Market bars → 3 Candles: bars · Feeds OHLCV bars into the candle-pattern logic
- Market bars → Windsurf EMA: bars · Feeds bars into EMA calculations
- Market bars → Essential Indicator: bars · Feeds bars into companion indicator logic
- Inputs → 3 Candles: tune · Configures detection thresholds and visual behavior
- Inputs → Windsurf EMA: tune · Configures EMA parameters and display options
- Inputs → Essential Indicator: tune · Configures companion indicator parameters
- 3 Candles → Chart signals: render · Emits pattern markers and overlays
- 3 Candles → Alerts: signal · Optional alert conditions for detected setups
- Windsurf EMA → Chart signals: render · Emits trend overlay or filtered visual cues
- Essential Indicator → Chart signals: render · Emits additional chart annotations or plots
- Essential Indicator → Alerts: signal · Optional alert conditions for its own setups
