PROTECTED SOURCE SCRIPT
Funding Rate Strategy Indicator

Description
Funding Rate Backtest Strategy uses smoothed funding‐rate dynamics to trigger long/short trades, enhanced by volume, session and daily‐limit filters, plus configurable profit-taking, stop-loss and trailing stops. It is designed for perpetual‐swap markets (e.g. BTCUSDT) where funding costs reflect market sentiment.
1. Strategy Logic & Components
Funding Rate Source
External: real exchange funding rate (e.g. Binance funding).
Custom: manual override value.
Simulate: sine‐wave test data between –3 and +3 to validate behavior.
Entry Conditions
LONG when fundingRate ≤ Long Threshold (default –2.0)
SHORT when fundingRate ≥ Short Threshold (default +2.0)
Volume Filter: requires a ≥ 5% increase vs prior bar.
4H Session Filter: only triggers on new 4-hour bars (optional).
Daily Cap: max 5 signals per calendar day (prevents overtrading).
Weekend Trading: on/off toggle for Saturday–Sunday.
Exit Conditions
Funding Normalization: exit LONG when fundingRate > –0.5; exit SHORT when fundingRate < +0.5.
Profit-Taking & Stop-Loss: default TP = 5%, SL = 3% of entry price.
Trailing Stop: optional 2% trailing (togglable).
2. Default Settings & Backtest Parameters
Account Size: $10,000
Position Sizing: 10% of equity per trade
Commission: 0.10% per side
Slippage: 0.05% per trade
Instrument & Timeframe: BTCUSDT perpetual, 1H bars, Jan 1 2022 – Dec 31 2023
Volume Increase: 5%
Session Filter: 4-hour bars only
Max Signals/Day: 5
Weekend Trading: Enabled
3. Backtest Results (Jan 2022–Dec 2023)
Total Trades: 142
Win Rate: 55.6%
Average R/R: 1 : 1.4
Max Drawdown: 14.8%
Net Return: +22.3%
These results assume realistic commission (0.1%) and slippage (0.05%). Past performance is not indicative of future results.
4. Default Properties Explained
Property Default Description
rateSourceChoice External Select funding‐rate data source
fundingRateLongThreshold –2.0 Funding ≤ –2% → LONG condition
fundingRateShortThreshold +2.0 Funding ≥ +2% → SHORT condition
volumeIncreasePercent 5.0 Min % volume increase vs prior bar
enableFourHourFilter true Only trigger on new 4H sessions
maxSignalsPerDay 5 Daily cap on entries
exitLongThreshold –0.5 Funding > –0.5% → exit LONG
exitShortThreshold +0.5 Funding < +0.5% → exit SHORT
takeProfitPercent 5.0 Fixed profit target in %
stopLossPercent 3.0 Fixed stop‐loss in %
useTrailingStop false Toggle trailing stop
trailingStopPercent 2.0 Trailing stop distance in %
allowWeekendTrading true Allow entries on Sat/Sun
5. How to Use
Add to Chart → search “Funding Rate Backtest.”
Configure Inputs → choose your funding‐rate feed, adjust thresholds, volume and session filters.
Position Sizing → defaults to 10% equity; adjust if desired.
Monitor Table & Signals → on‐chart shapes mark entries/exits; status table shows open P&L and signals count.
Risk Management → always verify commission/slippage settings; limit risk to sustainable levels (≤ 10% equity per trade).
6. Warnings & Disclaimer
This strategy is for educational purposes only. Real funding rates may differ—replace simulation or custom inputs with actual data. Always apply your own analysis and risk management. Past backtest performance does not guarantee future results.
Funding Rate Backtest Strategy uses smoothed funding‐rate dynamics to trigger long/short trades, enhanced by volume, session and daily‐limit filters, plus configurable profit-taking, stop-loss and trailing stops. It is designed for perpetual‐swap markets (e.g. BTCUSDT) where funding costs reflect market sentiment.
1. Strategy Logic & Components
Funding Rate Source
External: real exchange funding rate (e.g. Binance funding).
Custom: manual override value.
Simulate: sine‐wave test data between –3 and +3 to validate behavior.
Entry Conditions
LONG when fundingRate ≤ Long Threshold (default –2.0)
SHORT when fundingRate ≥ Short Threshold (default +2.0)
Volume Filter: requires a ≥ 5% increase vs prior bar.
4H Session Filter: only triggers on new 4-hour bars (optional).
Daily Cap: max 5 signals per calendar day (prevents overtrading).
Weekend Trading: on/off toggle for Saturday–Sunday.
Exit Conditions
Funding Normalization: exit LONG when fundingRate > –0.5; exit SHORT when fundingRate < +0.5.
Profit-Taking & Stop-Loss: default TP = 5%, SL = 3% of entry price.
Trailing Stop: optional 2% trailing (togglable).
2. Default Settings & Backtest Parameters
Account Size: $10,000
Position Sizing: 10% of equity per trade
Commission: 0.10% per side
Slippage: 0.05% per trade
Instrument & Timeframe: BTCUSDT perpetual, 1H bars, Jan 1 2022 – Dec 31 2023
Volume Increase: 5%
Session Filter: 4-hour bars only
Max Signals/Day: 5
Weekend Trading: Enabled
3. Backtest Results (Jan 2022–Dec 2023)
Total Trades: 142
Win Rate: 55.6%
Average R/R: 1 : 1.4
Max Drawdown: 14.8%
Net Return: +22.3%
These results assume realistic commission (0.1%) and slippage (0.05%). Past performance is not indicative of future results.
4. Default Properties Explained
Property Default Description
rateSourceChoice External Select funding‐rate data source
fundingRateLongThreshold –2.0 Funding ≤ –2% → LONG condition
fundingRateShortThreshold +2.0 Funding ≥ +2% → SHORT condition
volumeIncreasePercent 5.0 Min % volume increase vs prior bar
enableFourHourFilter true Only trigger on new 4H sessions
maxSignalsPerDay 5 Daily cap on entries
exitLongThreshold –0.5 Funding > –0.5% → exit LONG
exitShortThreshold +0.5 Funding < +0.5% → exit SHORT
takeProfitPercent 5.0 Fixed profit target in %
stopLossPercent 3.0 Fixed stop‐loss in %
useTrailingStop false Toggle trailing stop
trailingStopPercent 2.0 Trailing stop distance in %
allowWeekendTrading true Allow entries on Sat/Sun
5. How to Use
Add to Chart → search “Funding Rate Backtest.”
Configure Inputs → choose your funding‐rate feed, adjust thresholds, volume and session filters.
Position Sizing → defaults to 10% equity; adjust if desired.
Monitor Table & Signals → on‐chart shapes mark entries/exits; status table shows open P&L and signals count.
Risk Management → always verify commission/slippage settings; limit risk to sustainable levels (≤ 10% equity per trade).
6. Warnings & Disclaimer
This strategy is for educational purposes only. Real funding rates may differ—replace simulation or custom inputs with actual data. Always apply your own analysis and risk management. Past backtest performance does not guarantee future results.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.