The short answer is no, it's not possible because Tradingview doesn't provide that level of data. Sites like coinalyze are using the Tradingview plugin and providing their own data streams for liquidations.
To create the equivalent on the Trandingview platform itself there is something of a workaround but it is less than ideal. It won't be live data and you will have to manually update the data array yourself. You will also have to source the liquidation data yourself.
You will have to take note of the timestamp of the first data entry and parse the liquidation data into a set of comma separated values.
From there you can "import" it into a script using array.from()
start_timestamp = timestamp(2021, 7, 9, 0, 0, 0)
var float[] a_longLiqs = array.from(17, 13458.4, 87453.56, 2345.23 , 23457.983, 353, .... etc)
var int index = na
var bool started = false
float longLiqs = na
if time == start_timestamp
started := true
index := 0
else if time > start_timestamp
index += 1
if started and index < array.size(a_longLiqs)
longLiqs := array.get(a_longLiqs, index)
plot(longLiqs)
At this point you've effectively converted the array into a time series variable longLiqs
which you can work with the same as any other, such as close
, volume
, etc. However you only get new data when you add it to the array manually.
To obtain the aggregate data itself is a bit of a process. You have to make use of the exchange's APIs.
For example :
https://www.bitmex.com/api/explorer/#/Liquidation
https://bybit-exchange.github.io/docs/inverse/#t-query_liqrecords
There are quite a number of existing projects on github in both js and python, I suggest you start there rather than reinvent the wheel. For example the cryptofeed py package might be a good place to start as it seems to support pulling the liquidation data over multiple exchanges.
https://pypi.org/project/cryptofeed/
https://github.com/bmoscon/cryptofeed/blob/master/docs/callbacks.md
Once you have the data you'll have to aggregate it yourself and parse it like I mentioned above to be able to insert it into a pine array.
Alternatively there are paid data providers that may make it a bit easier if you're ok with paying for the data. You may still need to aggregate it and parse it, but you'll only be dealing with one API rather than having to manage it from every exchange.
Here's one I've found that seems to provide aggregate liquidation data : https://www.cryptometer.io/api-doc/