OPEN-SOURCE SCRIPT

Synthetic Implied APR

243
Overview

The Synthetic Implied APR is an artificial implied APR, designed to imitate the implied APR seen when trading cryptocurrency funding rates. It combines real-time funding rates with premium data to calculate an artificial market expectation of the annualized funding rate.

The (actual) implied APR is the market's expectation of the annualized funding rate. This is dependent on bid/ask impacts of the implied APR, something which is currently unavailable to fetch with TradingView. In essence, an implied APR of X% means traders believe that asset's funding fees to average X% when annualized.

What's important to understand, is that the actual value of the synthetic implied APR is not relevant. We only simply use its relative changes when we trade (i.e if it crosses above/below its MA for a given weight). Even for the same asset, the implied APRs will change depending on days to maturity.

How it calculates

The synthetic implied APR is calculated with these steps:
  1. Collects premium data from perpetual futures markets using optimized lower timeframe requests (check my 'Predicted Funding Rates' indicator)
  2. Calculates the funding rate by adding the premium to an interest rate component (clamped within exchange limits)
  3. Derives the underlying APR from the 8-hour funding rate (funding rate × 3 × 365)
  4. Apply a weighed formula that imitates both the direction (underlying APR) with the volatility of prices (from the premium index and funding)


Pine Script®
premium_component = (prem_avg / 50 ) * 365 weighedprem = (weight * fr) + ((1 - weight) * apr) + (premium_component * 0.3) impliedAPR = math.avg(weighedprem, ta.sma(apr, maLength))


How to use it: Generally

Preface: Funding rates are an indication of market sentiment
  • If funding is positive, generally the market is bullish as longs are willing to pay shorts funding
  • If funding is negative, generally the market is bearish as shorts are willing to pay longs funding


So, this script can be used like a typical oscillator:
  • Bullish: If implied APR > MA OR if implied APR MA is green
  • Bearish: If implied APR < MA OR if implied APR MA is red


The components:
  • Synthetic Implied APR: The main metric. At current setting of 0.7, it imitates volatility
  • Weight: The higher the value, the smoother the synthetic implied APR is (and MA too). This value is very important to the imitation. At 0.7, it imitates the actual volatility of the implied APR. At weight = 1, it becomes very smooth. Perfect for trading
  • Synthetic Implied APR Moving Average: A moving average of the Synthetic implied APR. Can choose from multiple selections, (SMA, EMA, WMA, HMA, VWMA, RMA)


How to use it: Trading Funding

When trading funding there're multiple ways to use it with different settings

Trade funding rates with trend changes
  • Settings: Weight = 1
  • Method 1: When the implied APR MA turns green, long funding rates (or short if red)
  • Method 2: When the implied APR crosses above the MA, long funding rates (or short when crosses below)


cuplikan

Trade funding rates with MA pullbacks
  • Settings: Weight = 0.7, timeframe 15m
  • In an uptrend: When implied APR crosses below then above the script, long funding opportunity
  • In an downtrend: When implied APR crosses above then below the script, shortfunding opportunity
  • You can determine the trend with the method before, using a weight of 1


cuplikan

To trade funding rates, it's best to have these 3 scripts at these settings:
  1. Predicted Funding Rates: This allows you to see the predicted funding rates and see if they've maxxed out for added confluence too (+/-0.01% usually for Binance BTC futures)
  2. Synthetic implied APR: At weight 1, the MA provides a good trend (whether close above/below or colour change)
  3. Synthetic implied APR: At weight 0.7, it provides a good imitation of volatility


How to use it: Trading Futures

When trading futures:
  • You can determine roughly what the trend is, if the assumption is made that funding rates can help identify trends if used as a sentiment indicator. It should be supplemented with traditional trend trading methods
  • To prevent whipsaws, weight should remain high
  • Long trend: When the implied APR MA turns green OR when it crosses above its MA
  • Short trend: When the implied APR MA turns red OR when it below above its MA


cuplikan

Why it's original

This indicator introduces a unique synthetic weighting system that combines funding rates, underlying APR, and premium components in a way not found in existing TradingView scripts. Trading funding rates is a niche area, there aren't that many scripts currently available. And to my knowledge, there's no synthetic implied APR scripts available on TradingView either. So I believe this script to be original in that sense.

Notes
Because it depends on my triangular weighting algos, optimal accuracy is found on timeframes that are 4H or less. On higher timeframes, the accuracy drops off. Best timeframes for intraday trading using this are 15m or 1 hour
The higher the timeframe, the lower the MA one should use. At 1 hour, 200 or higher is best. At say, 4h, length of 50 is best
Only works for coins that have a Binance premium index

Inputs
  • Funding Period - Select between "1 Hour" or "8 Hour" funding cycles. 8 hours is standard for Binance
  • Table - Toggle the information dashboard on/off to show or hide real-time metrics including funding rate, premium, and APR value
  • Weight - Controls the balance between funding rate (higher values = smoother) and APR (lower values = more responsive) in the calculation, ranging from 0.0 to 1.0. Default is 0.7, this imitates the volatility
  • Auto Timeframe Implied Length - Automatically calculates optimal smoothing length based on your chart timeframe for consistent behavior across different time periods
  • Manual Implied Length - Sets a fixed smoothing length (in bars) when auto mode is disabled, with lower values being more responsive and higher values being smoother
  • Show Implied APR MA - Displays an additional moving average line of the Synthetic Implied APR to help identify trend direction and crossover signals
  • MA Type for Implied APR - Selects the calculation method (SMA, EMA, WMA, HMA, VWMA, or RMA) for the moving average, each offering different responsiveness and lag characteristics
  • MA Length for Implied APR - Sets the lookback period (1-500 bars) for the moving average, with shorter lengths providing more signals and longer lengths filtering noise
  • Show Underlying APR - Displays the raw APR calculation (without synthetic weighting) as a reference line to compare against the main indicator
  • Bullish Color - Sets the color for positive values in the table and rising MA line
  • Bearish Color - Sets the color for negative values in the table and falling MA line
  • Table Background - Customizes the background color and transparency of the information dashboard
  • Table Text Color - Sets the color for label text in the left column of the information table
  • Table Text Size - Controls the font size of table text with options from Tiny to Huge

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.