Pine Script v6 ยท TradingView indicator + Python microservice
HTF Mirror projects the developing higher-timeframe (HTF) candle โ default 4H โ into the right margin of any chart: solid body, dotted range footprint, open level, equilibrium, and a High / Low / Last + countdown label.
Disclaimer: HTF Mirror is an analytical tool, not financial advice. Trading involves substantial risk of loss. Past performance does not guarantee future results. You are solely responsible for your decisions.
| Component | What it is | Where it lives |
|---|---|---|
HTF Mirror.pine |
TradingView indicator (Pine Script v6). Draws the chart projection. | HTF Mirror.pine |
service/ |
Stateless Python microservice. Exposes the same projection math over HTTP so external engines (MT5, Python bots, backtesters) can consume it. | service/ |
| Element | Description |
|---|---|
| Projected candle | Solid body + wick of the developing HTF candle, drawn in the right margin. |
| Dotted range footprint | High/low box of the live HTF candle from period start. |
| Open level | Dotted line at the HTF open. |
| Equilibrium | Dotted line at 50% of the range (high + low) / 2. |
| Side label | High / Low / Last price and countdown to HTF close. |
| Group | Key inputs |
|---|---|
| HTF | HTF timeframe (default 240 = 4H), manual label prefix. |
| Projection | Right-margin offset, body width, toggles for range / wick / open / EQ. |
| Style | Monochrome or PO3 gradient (bull / bear / weak), transparency. |
| Label | Size, countdown toggle. |
- Open TradingView โ Pine Editor.
- Paste the contents of
HTF Mirror.pine. - Add to chart.
The projection uses non-repainting request.security with lookahead_off. The
developing candle updates live (intrabar).
Pine runs only inside TradingView โ it cannot be containerized or called by an
external engine. The service/ directory ports the indicator's deterministic math
to a stateless FastAPI service so any trading engine can obtain the same projection
over HTTP.
cd service
docker build -t htf-mirror-service .
docker run --rm -p 8000:8000 htf-mirror-servicecurl -s http://localhost:8000/v1/projection \
-H 'Content-Type: application/json' \
-d '{"bars":[{"open":10,"high":12,"low":9,"close":11},
{"open":11,"high":20,"low":8,"close":18}]}'{
"open": 10.0, "high": 20.0, "low": 8.0, "last": 18.0,
"equilibrium": 14.0, "range": 12.0, "strength": "bull", "countdown": "--:--:--"
}Full API docs, MT5 integration guide, and architecture diagram: service/README.md
Commercial build. TradingView access control (Invite-Only / Whop) is enforced via TradingView publish settings. The microservice compute core ships for use in your own engines.