BitcoinCounterFlow
  • Charts
    MarktchartsAll indicators in one place.
    DashboardsData-riched mini-charts.
    SuperChartAdvanced multi-panel view.
    OmniFlow-ModellMarket regime identification.
    Liquidations-HeatmapIdentify liquidity clusters.
    ETF-TrackerWall Street capital flows.
  • Tools
    Backtest & ModelleBuild your own quants.
    ScannerFind past market triggers.
    PositionssignaleAI-powered trade signals.
    Custom IndicatorsBuild indicators visually.
    ScriptingWrite and read scripts.
    Indicator ScannerRank market extremes.
    Anomaly DetectionSpot unusual Bitcoin moves.
    ErweiterungLive data in your browser.
    BCF AI AssistantAsk with market context.
  • Ressourcen
    RechnerPlan Bitcoin purchases.
    BerichteMonthly market analysis.
    LernenMaster the indicators.
    AcademyExplore learning library.
    ChangelogLatest product updates.
    ClockWatchGlobal market sessions.
  • Community
  • API
  • MCP
  • Preise

Indikator erstellen

Modus
Stil
Signallinie
Referenzlinien
Markiere Extremwerte (z. B. RSI 70/30) mit einer horizontalen Linie. Ein Marker erscheint im Preis-Panel, wenn der Indikator sie kreuzt.

0/4 benutzerdefinierte Panels aktiv

IndikatoransichtKerzen werden geladen…
Indikator-Scanner
AssetBTCUSDT
Zeitrahmen
~0 candles
Opening market data channel06%
Indikatorergebnisse
0 saved preview panels

Diagrammeinstellungen

Darstellung · Verhalten
Designs
Kerzenfarben
Linear · Lokal · Pure Gray

Meine Indikatoren

Saving indicators to your account requires a Maxi plan or above. You can still build and copy the script.

Ask AI to write this for you

Copy this and paste it into ChatGPT, Claude, or any AI, then paste the JavaScript it gives you back into the editor on the left.

You are helping write a custom indicator script for BitcoinCounterFlow's Custom Indicators builder.

## Contract

You write the body of a JavaScript function that receives one argument, `api`, and must `return` an array of series.

- `api.candles`: array of candle objects, oldest first, one per bar. Every candle has `time` (unix seconds), `open`, `high`, `low`, `close`, `volume`, plus whichever of the fields below have data for the loaded window — a field can be missing on some candles, so check with `Number.isFinite(c.someField)` before using it.
- `api.log(...)`: prints to a debug console inside the app. Optional, for your own testing.
- Return an array of 1 or more series objects:
  `{ name: string, type: 'line' | 'histogram', color?: string, data: Array<number | null> }`
  `data` MUST have exactly one entry per candle, same order as `api.candles`. Use `null` for a gap (warmup, missing data) — never `0` or a made-up number as a stand-in for "no data".
- Plain JavaScript only: no `import`, no `require`, no `fetch`, no DOM or `window` access.

## Available candle fields

Price & Volume: close, open, high, low, volume, volumeUsd, price_change, volatility, drawdown, drawdown_cycle
Technical: rsi, atr, macd, macd_signal, macd_histogram, stoch_k, stoch_d, bbands_upper, bbands_middle, bbands_lower, bbands_pctb, bbands_bandwidth, sma20, sma50, sma200, rsi_divergence
Momentum & Volume: williams_r, cci, roc, trix, ao, adx, plus_di, minus_di, mfi, obv, adl, force_index
Trend & Channels: atr_pct, supertrend, supertrend_dir, psar, keltner_upper, keltner_middle, keltner_lower, donchian_upper, donchian_middle, donchian_lower, vwap, vwap_upper, vwap_lower
Cycle Tools: mayer_multiple, pi_cycle_gap, bmsb_mid, bmsb_distance, two_year_ma_mult, hash_ribbon_gap
Order Flow: taker_delta, taker_delta_pctl, cvd, cvd_change, taker_buy_ratio
Derivatives: funding_rate, funding_pctl, open_interest, oi_change, long_short_ratio, long_short_ratio_change, lsr_change_pctl, net_longs, net_longs_pctl, net_shorts, net_shorts_pctl, crowding
Liquidations: liquidations_long, liquidations_short, liquidations_total, liquidations_skew, liquidations_pctl, liquidations_long_pctl, liquidations_short_pctl, liquidations_streak
On-chain: mvrv, nupl, sopr, puell, vdd, hash_rate, hash_rate_pctl, realized_pl, realized_pl_pctl, dominance
Sentiment & Flow: fear_greed, google_trends, etf_inflow, etf_flow_pctl, etf_flow_streak
Macro & Cycle: m2, m2_change, dxy, dxy_change, cycle_phase, cycle_progress, cycle_year

### Example 1 — single field, moving average

return [{
  name: 'Funding SMA 20',
  type: 'line',
  data: api.candles.map((c, i) => {
    if (i < 19) return null;
    let sum = 0;
    for (let j = i - 19; j <= i; j++) {
      const v = Number(api.candles[j].funding_rate);
      if (!Number.isFinite(v)) return null;
      sum += v;
    }
    return sum / 20;
  })
}];

### Example 2 — two fields, two panels

return [
  {
    name: 'Close',
    type: 'line',
    data: api.candles.map((c) => (Number.isFinite(c.close) ? c.close : null))
  },
  {
    name: 'Funding Rate',
    type: 'histogram',
    color: '#e6c160',
    data: api.candles.map((c) => (Number.isFinite(c.funding_rate) ? c.funding_rate : null))
  }
];

## Task

Write a script that satisfies the contract above. Reply with ONLY the JavaScript code (no markdown fences, no explanation) — the body that goes where the examples' `return [...]` appears.