Bybit Funding Rate and Premium Index Indicator
Overview
The "Bybit Funding Rate and Premium Index" indicator is a comprehensive tool designed for traders using perpetual contracts on Bybit and other exchanges. It provides real-time visualization of funding rates, premium index, and average premium, along with multiple moving averages and trading signals.
Key Features
- Multiple Display Modes: Toggle between Funding Rate, Premium Index, Average Premium, and Candle representations
- Multi-Exchange Support: Pulls spot prices from Bybit, Bitget, MEXC, Binance, KuCoin, OKX, and Kraken
- Customizable Moving Averages: 5 configurable MAs (SMA or EMA) with adjustable lengths
- Visual Trading Signals: Identifies potential long and short opportunities based on funding rate extremes
- Interactive Table: Displays current funding rate and spot exchange being used
- Custom Horizontal Lines: Configurable reference lines for key levels
- Lower Timeframe Option: Ability to view data from a lower timeframe
Indicator Components
1. Funding Rate Calculation
The indicator calculates the funding rate using the formula:
funding_rate = avg_premium + clamp(0.01 - avg_premium, -0.05, 0.05)
where avg_premium
is the 8-hour moving average of the premium index.
2. Premium Index Calculation
The premium index is calculated as:
premium_index = (perp_close - spot_close) / spot_close * 100
This shows the percentage difference between the perpetual contract price and the spot price.
3. Moving Averages
The indicator includes 5 configurable moving averages (SMA or EMA) with default lengths:
- MA 1: 6 periods
- MA 2: 30 periods
- MA 3: 60 periods
- MA 4: 120 periods
- MA 5: 240 periods
4. Trading Signals
The indicator generates several types of trading signals:
- Big Long Signal: Triggered when funding rate crosses below the bottom threshold after staying above it for 333 bars
- Big Short Signal: Triggered when funding rate crosses above the top threshold after staying below it for 333 bars
- Regular Long/Short Signals: Based on MA 5 crossing key thresholds
Input Parameters
The indicator offers numerous customization options:
Display Options
- Mode: Select between FR (Funding Rate), Premium Index, Avg Premium, or FR - Candle display
- Use Lower Timeframe: Enable to view data from a lower timeframe
- Show Table: Toggle the information table on/off
Moving Average Settings
- Moving Average Type: Choose between SMA or EMA
- MA Lengths: Adjustable lengths for all 5 moving averages
Threshold Levels
- Top/Bottom Line Values: Customize the key threshold levels for signals
- Plus/Minus Line Values: Set additional reference lines
Usage Tips
Note: This indicator works best with Bybit perpetual contracts (symbols ending with .P).
- Positive funding rates (red area) suggest traders are paying to be long
- Negative funding rates (green area) suggest traders are paying to be short
- Extreme readings may indicate potential reversal points
- Watch for divergences between price and funding rate
- The 8-hour average premium (yellow line) provides a smoother view of market bias
Code
//@version=5 indicator("Bybit Funding Rate and Premium Index", precision = 4, format = format.percent, overlay=false) [Rest of the indicator code...]
Disclaimer
This indicator is for educational purposes only and should not be considered as financial advice. Always conduct your own research and backtesting before making any trading decisions.