TradingView Pine Script that overlays Shariah-compliance status on any chart.
TSLA HALAL ✓ ← rendered as a label on your chart
JPM NON-COMPLIANT ✗
ABCD NOT IN DATASET
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 / 0so 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.
- Open the latest
pine/halal-screener.pine. - Copy the whole file into TradingView's Pine Editor (Pine v5).
- Save → Add to chart.
- Switch tickers and watch the badge update.
That's it. No build step required for end users.
ℹ️ The committed
halal-screener.pineships 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.
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.mjsEdit pine/symbols.txt to include your tickers (one per line, # comments allowed). Re-run the script and copy pine/halal-screener.pine into TradingView.
pine/symbols.txtlists the ticker universe.scripts/generate-pine.mjscallsPOST /api/screen/{symbol}for each, classifies the verdict aspass/fail/unknown, and writes a Pine v5 file that contains two embeddedarray<string>constants —HALALandHARAM.- The Pine indicator looks up
syminfo.tickeragainst those arrays, draws the badge/ribbon/table, and fires an alert if the ticker is non-compliant. - Regenerate on demand:
node scripts/generate-pine.mjs(with aHALAL_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.
| 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 |
- Methodology — the API returns AAOIFI by default. To use DJIM/FTSE/MSCI/S&P, extend the
screencall inscripts/generate-pine.mjsto passmethodologyand bake separateHALAL_DJIM/HALAL_FTSEarrays. - Visual style — tweak
statusColorandstatusBginscripts/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.
Automated screening, not a fatwa. Consult a qualified scholar for personal rulings.
- Halal ETF screener
- Shariah-compliant ETFs compared (2026)
- Is my stock halal? Screener
- Sukuk screening guide
- API reference
Website · API · Python SDK · JS SDK · MCP server · Claude plugin · Discord bot · Portfolio tracker
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 |
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