OPEN-SOURCE SCRIPT

Bitcoin Margin Call Envelopes [saraphig & alexgrover]

Bitcoin is the most well known digital currency, and allow two parties to make a transaction without the need of a central entity, this is why cryptocurrencies are said to be decentralized, there is no central unit in the transaction network, this can be achieved thanks to cryptography. Bitcoin is also the most traded cryptocurrency and has the largest market capitalization, this make it one of the most liquid cryptocurrency.

There has been tons of academic research studying the profitability of Bitcoin as well as its role as a safe heaven asset, with all giving mixed conclusions, some says that Bitcoin is to risky to be considered as an hedging instrument while others highlight similarities between Bitcoin and gold thus showing evidence on the usefulness of Bitcoin acting as an hedging instrument. Yet Bitcoin seems to attract more short term speculative investors rather than other ones that would use Bitcoin as an hedging instrument.

Once introduced, cryptocurrencies where of course heavily analyzed by technical analyst, and technical indicators where used by retail as well as institutional investors in order to forecast the future trends of bitcoin. I never really liked the idea of designing indicators that specifically worked for only one type of market and ever less on only one symbol. Yet the user saraphig posted in Feb 20 an indicator called "Margin Call MovingAverage" who calculate liquidation price by using a volume weighted moving average. It took my attention and we decided to work together on a relatively more complete version that would include resistances levels.

I believe the proposed indicator might result useful to some users, the code also show a way to restrict the use of an indicator to only one symbol (line 9 to 16).

Margin Call MovingAverage


The Indicator

The indicator only work on BTCUSD, if you use another symbol you should see the following message:

ảnh chụp nhanh

The indicator plot 6 extremities, with 3 upper (resistance) extremities and 3 lower (support) extremities, each one based on the isolated margin mode liquidation price formula:

UPlp = MA/Leverage × (Leverage+1-(Leverage*0.005))

for upper extremities and:

DNlp = MA × Leverage/(Leverage+1-(Leverage*0.005))

for lower extremities.

Length control the period of the moving averages, with higher values of length increasing the probability of the price crossing an extremity. The Leverage's settings control how far away their associated extremities are from the price, with lower values of Leverage making the extremity farther away from the price, Leverage 3 control Up3 and Dn3, Leverage 2 control Up2 and Dn2, Leverage 1 control Up1 and Dn1, saraphig recommend values for Leverage of either : 25, 20, 15, 10 ,5.

You can select 3 different types of moving average, the default moving average is the volume weighted moving average (VWMA), you can also choose a simple moving average (SMA) and the Kaufman adaptive moving average (KAMA).

Based on my understanding (which could be wrong) the original indicator aim to highlight points where margin calls might have occurred, hence the name of the indicator.

If you want a more "DSP" like description then i would say that each extremity represent a low-pass filter with a passband greater than 1 for upper extremities and lower than 1 for lower extremities, unlike bands indicators made by adding/subtracting a volatility indicator from another moving average this allow to conserve the original shape of the moving average, the downside of it being the inability to show properly on different scales.

ảnh chụp nhanh

here length = 200, on a 1h tf, each extremities are able to detect short-terms tops and bottoms. The extremity become wider when using lower time-frames.

ảnh chụp nhanh

You would then need to increase the Leverages settings, i recommend a time frame of 1h.

Conclusion

I'am not comfortable enough to make a conclusion, as i don't know the indicator that well, however i liked the original indicator posted by saraphig and was curious about the idea behind it, studying the effect of margin calls on market liquidity as well as making indicators based on it might result a source of inspiration for other traders.

A big thanks to saraphig who shared a lot of information about the original indicator and allowed me to post this one. I don't exclude working with him/her in the future, i invite you to follow him/her:

tradingview.com/u/saraphig/

Thx for reading and have a nice weekend! :3
bandsBitcoin (Cryptocurrency)BTCUSDEnvelope (ENV)margincallMoving AveragesTrend Analysis

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


Check out the indicators we are making at luxalgo: tradingview.com/u/LuxAlgo/
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm