Skip to content

About

TradingView Pine v5 indicator that overlays Shariah-compliance status on charts. Dated compliance snapshot from the Halal Terminal API.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

Halal Pine

TradingView Pine Script that overlays Shariah-compliance status on any chart.

MIT License Pine v5 Halal Terminal API Dated snapshot

TSLA  HALAL ✓                 ← rendered as a label on your chart
JPM   NON-COMPLIANT ✗
ABCD  NOT IN DATASET

Why this exists

TradingView is where most retail traders live, but its native screening has nothing for Muslim investors. This is a Pine v5 indicator that overlays AAOIFI Shariah-compliance status on any chart, with:

  • Top-right summary table — symbol + status + methodology
  • Above-bar label — quick visual cue
  • Background ribbon — green / red / gray tint
  • Alert — fires when a non-compliant ticker is loaded
  • Plottable signal — +1 / -1 / 0 so you can chain it into screeners or strategies

Because Pine Script can't make HTTP calls, the compliance dataset is baked into the script as a dated snapshot, screened against the Halal Terminal API. Each build stamps its screening date in the file header; Shariah verdicts change when issuers refile (typically quarterly), so the snapshot is regenerated on demand rather than on a schedule that would imply daily freshness. For a live, always-current verdict on any ticker, call the API directly.


Use it (no install — just copy)

  1. Open the latest pine/halal-screener.pine.
  2. Copy the whole file into TradingView's Pine Editor (Pine v5).
  3. Save → Add to chart.
  4. Switch tickers and watch the badge update.

That's it. No build step required for end users.

ℹ️ The committed halal-screener.pine ships as a hand-curated starter. Every day at 06:00 UTC the GitHub Action regenerates it against the live API and pushes the update — pull the repo or copy from GitHub for the freshest dataset.


Build it yourself (full universe)

If you want to control the symbol universe or methodology:

git clone https://github.com/goww7/halal-pine.git
cd halal-pine
cp .env.example .env
# add HALAL_TERMINAL_API_KEY=ht_... — free key at halalterminal.com
node scripts/generate-pine.mjs

Edit pine/symbols.txt to include your tickers (one per line, # comments allowed). Re-run the script and copy pine/halal-screener.pine into TradingView.


How it works

  1. pine/symbols.txt lists the ticker universe.
  2. scripts/generate-pine.mjs calls POST /api/screen/{symbol} for each, classifies the verdict as pass/fail/unknown, and writes a Pine v5 file that contains two embedded array<string> constants — HALAL and HARAM.
  3. The Pine indicator looks up syminfo.ticker against those arrays, draws the badge/ribbon/table, and fires an alert if the ticker is non-compliant.
  4. Regenerate on demand: node scripts/generate-pine.mjs (with a HALAL_TERMINAL_API_KEY), or run the manual Refresh Pine compliance snapshot GitHub Action. The build stamps its screening date into the file header.

To refresh on a fork, set a HALAL_TERMINAL_API_KEY repo secret and trigger the workflow manually.


Configuration

Env var Default Description
HALAL_TERMINAL_API_KEY required Free key at halalterminal.com
HALAL_API_BASE https://api.halalterminal.com Override the API host
HALAL_PINE_LIMIT unlimited Cap symbols screened (useful during dev)
HALAL_PINE_CONCURRENCY 4 Parallel screen requests

Customizing the Pine

  • Methodology — the API returns AAOIFI by default. To use DJIM/FTSE/MSCI/S&P, extend the screen call in scripts/generate-pine.mjs to pass methodology and bake separate HALAL_DJIM / HALAL_FTSE arrays.
  • Visual style — tweak statusColor and statusBg in scripts/generate-pine.mjs (the renderer template).
  • More fields — Pine arrays support strings only, so to embed ratios you'd need parallel arrays (HALAL_DEBT_RATIO, etc.). Keep the symbol list short if you go that route — Pine has line-count limits.

Disclaimer

Automated screening, not a fatwa. Consult a qualified scholar for personal rulings.


Learn more

Part of the Halal Terminal ecosystem

Website · API · Python SDK · JS SDK · MCP server · Claude plugin · Discord bot · Portfolio tracker


Related projects

Other open-source tools in the Halal Terminal ecosystem:

Project What it is
halal-discord-bot Discord bot — /halal, /portfolio, /trending slash commands
halal-portfolio-tracker Next.js portfolio compliance tracker (one-click Vercel deploy)
halalterminal-claude-skills Claude Code plugin with screening skills + portfolio-builder subagent
halalterminal-mcp MCP server for any MCP-compatible client (Cursor, Cline, Codex…)
yassir-oss Open-source ReAct agent for financial research

License

MIT — see LICENSE.

Built on top of Halal Terminal.


Part of the Halal Terminal open ecosystem: API · MCP server · Python SDK · JS SDK · Datasets · Awesome Islamic Finance

About

TradingView Pine v5 indicator that overlays Shariah-compliance status on charts. Dated compliance snapshot from the Halal Terminal API.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages