Binance Liquidations is a strategy and separate-pane indicator that estimates derivative volume activity by calculating the volume spread between Binance perps and Coinbase spot data.
//@version=4
strategy("Binance Liquidations", pyramiding=1, default_qty_type=strategy.cash, default_qty_value=1000, initial_capital=1000,overlay=false, currency=currency.USD, commission_type=strategy.commission.percent, commission_value=0.07)
fastLen = input(title="Fast Ma lenght", type=input.integer, defval=8)
slowLen = input(title="Slow Ma lenght", type=input.integer, defval=22)
premVal = input(title="Premium Value", type=input.float, defval=2000000)
doTrades = input(title="Trades?", type=input.bool, defval=true)
onlyLong = input(title="Only long?", type=input.bool, defval=true)
smoothStrat = input(title="Smooth strat?", type=input.bool, defval=false)
diffStrat = input(title="Diff strat?", type=input.bool, defval=true)
maStrat = input(title="MA strat?", type=input.bool, defval=false)
timeRestr = input(title="Time restrictions?", type=input.bool, defval=true)
assetLiquidated = input(title="Pair", type = input.string, defval = "btcperp")
assetSpot = input(title="Pair", type = input.string, defval = "btc")
//res = input(title="resolution ", type=input.resolution, defval=timeframe.period)
coinbase = "coinbase:"+assetSpot+"usd"
binance = "binance:"+assetLiquidated
inDateRange = (time >= timestamp(syminfo.timezone, 2021,
01, 29, 0, 0) and time<=timestamp(syminfo.timezone, 2021,
04, 20, 0, 0)) or not timeRestr
A = security(coinbase,timeframe.period,volume)
B = security(binance,timeframe.period,volume)
premium = (B - A)
if (open < close)
premium := 0
//plot(wma(premium,fastLen), title="CME vs. Coinbase Spread", linewidth = 3, color = color.red)
//plot(wma(premium,slowLen), title="CME vs. Coinbase Spread", linewidth = 3, color = color.green)
supersmoother(_src, _length) =>
pi = 2 * asin(1)
s_a1 = exp(-sqrt(2) * pi / _length)
s_b1 = 2 * s_a1 * cos(sqrt(2) * pi / _length)
s_c3 = -pow(s_a1, 2)
s_c2 = s_b1
s_c1 = 1 - s_c2 - s_c3
ss = 0.0
ss := s_c1 * _src + s_c2 * nz(ss[1], _src[1]) + s_c3 * nz(ss[2], _src[2])
premiumSmooth = supersmoother(wma(premium,fastLen), fastLen*1.5)
hline(0, title="0", linewidth = 2, color = color.red, linestyle = hline.style_solid)
mainSeries = (diffStrat) ? premium : wma(premium,fastLen)
plot(mainSeries, linewidth = 2, color = color.white, style = (diffStrat) ? plot.style_histogram : plot.style_line)
series = (smoothStrat) ? premiumSmooth : na
series := (maStrat) ? wma(premium,slowLen) : na
plot(series, linewidth = 2, color = color.green)
wmaFast = wma(premium,fastLen)
WMA = wma(close, 4*24*5)
buySignal = false
sellSignal = false
if (doTrades)
buySignal := (smoothStrat) ? crossover(premiumSmooth,premVal) : crossover(wmaFast,premVal)
sellSignal := (smoothStrat) ? crossunder(premiumSmooth,premVal) : crossunder(wmaFast,premVal)
buySignal := (diffStrat) ? crossover(premium,premVal) : buySignal
sellSignal := (diffStrat) ? crossunder(premium,premVal) : sellSignal
buySignal := (maStrat) ? crossover(wmaFast,wma(premium,slowLen)) : buySignal
sellSignal := (maStrat) ? crossunder(wmaFast,wma(premium,slowLen)) : sellSignal
strategy.entry("long", strategy.long, when = buySignal and inDateRange and close > WMA)
strategy.entry("short", strategy.short, when = sellSignal and not onlyLong and inDateRange)
strategy.exit(id="XL TP", limit=strategy.position_avg_price * 1.01, stop=strategy.position_avg_price * 0.99)
Expand (75 lines)
Overview
Binance Liquidations applies Weighted Moving Averages and a SuperSmoother filter to the volume differential. Trades enter when the volume spread crosses a user-defined threshold while price remains above a long-term trend filter. Position exits are managed with fixed one-percent take-profit and stop-loss limits.
Volume spread calculation between Binance and Coinbase
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Fast Ma lenght
int
8
fastLen
Slow Ma lenght
int
22
slowLen
Premium Value
float
2000000
premVal
Trades?
bool
true
doTrades
Only long?
bool
true
onlyLong
Smooth strat?
bool
false
smoothStrat
Diff strat?
bool
true
diffStrat
MA strat?
bool
false
maStrat
Time restrictions?
bool
true
timeRestr
Pair
string
btcperp
assetLiquidated
Pair
string
btc
assetSpot
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy plots a MACD oscillator in a separate pane and trades Bitcoin futures from zero-line and signal-line crosses. Optional early momentum signals, a volume filter, and a trend moving-average filter can confirm entries. It sizes positions as fixed con
This strategy plots a comparative relative strength line against a benchmark symbol in a separate pane. It calculates price and volume simple moving averages alongside a multi-period highest high. Long trades enter using full equity when price exceeds its movi
This strategy plots an On-Balance Volume oscillator in a separate pane and applies a fast and a slow exponential moving average to it. It enters long or short when those averages cross, with a strategy type that can reverse, stay long only, or stay short only,
This overlay strategy is built for ES futures on the one-minute chart. It plots a volume-weighted moving average of price opens and standard-deviation bands at Fibonacci ratios, plus a second longer volume-weighted average from a higher-timeframe open. Call an
This strategy enters long when a faster moving average crosses above a slower one and short when it crosses below, unless long-only mode is on. An optional volume filter requires volume above a 20-bar average times a multiplier. Exits use a percentage stop los
This intraday strategy implements Mark Fisher's Opening Range Breakout (ORB) methodology tailored for index futures like ES and NQ. It calculates session opening ranges, volume z-scores, and VWAP bands to plot support, resistance, and confirmation levels on th