BitcoinCounterFlow
  • チャート
    マーケットチャートAll indicators in one place.
    ダッシュボードData-riched mini-charts.
    SuperChartAdvanced multi-panel view.
    OmniFlowモデルMarket regime identification.
    清算ヒートマップIdentify liquidity clusters.
    ETFトラッカーWall Street capital flows.
  • ツール
    バックテストとモデルBuild your own quants.
    ScannerSearch historical triggers across timeframes.
    ポジションシグナルAI-powered trade signals.
    Custom IndicatorsBuild Superchart indicators visually.
    ScriptingWrite and understand indicator scripts.
    Indicator ScannerRank indicators that read tops and bottoms.
    Anomaly DetectionExplore unusual Bitcoin market moves.
    拡張機能Live data in your browser.
  • リソース
    計算ツールCalculators and planning tools.
    レポートMonthly market analysis.
    学ぶMaster the indicators.
    AcademyThe complete learning library.
    記事Latest news and insights.
    ChangelogProduct updates and improvements.
    ClockWatchGlobal market sessions.
  • コミュニティ
  • API
  • MCP
  • 料金

インジケーターを作成

モード
スタイル
シグナルライン
基準線
水平線で極端な値(例: RSI 70/30)を示します。インジケーターが線を通過すると価格パネルにマーカーが表示されます。

0/4 カスタムパネルが有効

インジケーター表示ローソク足を読み込み中…
インジケータースキャナー
銘柄BTCUSDT
時間足
~0 candles
Opening market data channel06%
インジケーターの結果
0 saved preview panels

チャート設定

テーマ
ローソク足の色
線形 · ローカル · Pure Gray

マイインジケーター

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.