ⓘ Educational research tool · We do NOT accept funds, manage money, or offer investment returns · Not affiliated with Noosphere Ventures · Open-source · CC-BY-4.0
TradingView Integration

SIGMA Risk Indicator for TradingView

Add Noosphere Prime SIGMA sovereign risk scores directly to your TradingView charts. Free Pine Script — works with any country ETF, sovereign bond, or macro chart.

50M+
TradingView Users
potential reach
2 min
Setup Time
copy-paste Pine Script
Free
Cost
public API, no auth
How to Add in 3 Steps
1
Open Pine Script Editor
In TradingView, click "Pine Script Editor" at the bottom of your chart.
2
Paste the Script
Copy the Pine Script below and paste it into the editor. Click "Add to chart".
3
Update SIGMA values
Go to noosphereprime.space/api/public/sigma/{country} to get the latest score and paste in the indicator settings.
Pine Script v5
Get latest scores →
//@version=5
indicator("Noosphere SIGMA Sovereign Risk", overlay=false, max_lines_count=10)

// ─── Configuration ────────────────────────────────────────────────────────────
country = input.string("turkey", "Country Slug", tooltip="Use the slug from noosphereprime.space/intel/country/[slug]")
showRegime = input.bool(true, "Show Regime Band")
showEWS    = input.bool(true, "Show EWS Alert")

// ─── Color palette ────────────────────────────────────────────────────────────
COLOR_CRITICAL  = color.new(color.red,    10)
COLOR_STRESS    = color.new(color.orange, 10)
COLOR_ACCUM     = color.new(color.yellow, 10)
COLOR_STABLE    = color.new(color.green,  10)

// ─── Fetch SIGMA data from Noosphere public API ───────────────────────────────
// NOTE: TradingView requires HTTPS endpoints. The API is public, no auth needed.
[sigma_close, sigma_open, sigma_high, sigma_low] = request.security(
  "ECONOMICS:" + str.upper(country) + "GDP",  // placeholder — see instructions
  timeframe.period,
  [close, open, high, low]
)

// ─── Manual input fallback (update daily from noosphereprime.space/api/public/sigma/{slug}) ─
sigma_score = input.float(71.3, "SIGMA Score (manual)", minval=0, maxval=100)
r0_value    = input.float(1.85, "R₀ Contagion Coefficient", minval=0)
ews_active  = input.bool(true, "EWS Active")

// ─── Regime classification ────────────────────────────────────────────────────
regime_color = sigma_score >= 75 ? COLOR_CRITICAL :
               sigma_score >= 60 ? COLOR_STRESS   :
               sigma_score >= 45 ? COLOR_ACCUM    : COLOR_STABLE

regime_label = sigma_score >= 75 ? "CRITICAL" :
               sigma_score >= 60 ? "STRESS"   :
               sigma_score >= 45 ? "WARNING"  : "STABLE"

// ─── Plot ─────────────────────────────────────────────────────────────────────
plot(sigma_score, "SIGMA Score", regime_color, linewidth=2)
hline(75, "Critical Threshold", color.new(color.red, 60), linestyle=hline.style_dashed)
hline(60, "Stress Threshold",   color.new(color.orange, 60), linestyle=hline.style_dashed)
hline(45, "Warning Threshold",  color.new(color.yellow, 60), linestyle=hline.style_dashed)

// ─── Background band ──────────────────────────────────────────────────────────
bgcolor(showRegime ? color.new(regime_color, 90) : na)

// ─── EWS Alert ────────────────────────────────────────────────────────────────
if showEWS and ews_active
    label.new(bar_index, sigma_score + 2, "⚠ EWS ACTIVE",
              color=color.new(color.red, 0), textcolor=color.white, size=size.small)

// ─── Info table ───────────────────────────────────────────────────────────────
var table info = table.new(position.top_right, 2, 4, bgcolor=color.new(color.black, 70), border_color=color.new(color.gray, 60), border_width=1)
if barstate.islast
    table.cell(info, 0, 0, "NOOSPHERE SIGMA", text_color=color.new(color.yellow, 0), text_size=size.small)
    table.cell(info, 1, 0, str.tostring(sigma_score, "#.0") + "/100", text_color=regime_color, text_size=size.small)
    table.cell(info, 0, 1, "Regime", text_color=color.gray, text_size=size.small)
    table.cell(info, 1, 1, regime_label, text_color=regime_color, text_size=size.small)
    table.cell(info, 0, 2, "R₀ Contagion", text_color=color.gray, text_size=size.small)
    table.cell(info, 1, 2, str.tostring(r0_value, "#.##"), text_color=r0_value > 1.5 ? color.red : r0_value > 1.0 ? color.orange : color.green, text_size=size.small)
    table.cell(info, 0, 3, "EWS", text_color=color.gray, text_size=size.small)
    table.cell(info, 1, 3, ews_active ? "ACTIVE ⚠" : "clear", text_color=ews_active ? color.red : color.green, text_size=size.small)
Live Data for Manual Input