samfanderson1597

Buy the Dip? Sell the Rip? BTC Linear Regression Indicator

Short
BITSTAMP:BTCUSD   Bitcoin
Built this indicator using a 377-period daily linear regression on the BTC Chart. Then, I measured the % difference between the price of BTC and the value of the linear regression.
In theory: you should buy the dip and sell the rip.
But how to know when?
I think that whenever BTC trades at a ~34% premium to its 377-day linear regression, then it may be due for a retracement. Whenever BTC trades at a ~30% discount to its 377-day linear regression, then it may be due for a dead-cat bounce.

BTC currently trades for a ~40% premium to the previously mentioned linear regression . . . i think we are due for a pullback.

It has traded as high as a 53% premium in 2021 so maybe the top isn't in. However, is an extra 13% gain worth a 20% drawdown?

NFA: I'm just short it and close my eyes.

Appreciate any questions/comments.
Comment:
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © samfanderson1597

//@version=5
indicator(title="Linear Regression Curve BTC Delta %", shorttitle="LRC Delta %", overlay=false,timeframe = "", precision = 5)
// resIn = input("D", "Resolution")
resIn_0 = input.timeframe(title='Resolution for Funding Interval', defval='')
res = resIn_0 == '0' ? timeframe.period : resIn_0

resIn_1 = input.timeframe(title='Resolution for TWAP Interval', defval='')
res_1 = resIn_1 == '0' ? timeframe.period : resIn_1

ticker1fut = input.symbol("INDEX:BTCUSD", "Symbol 1 Fut", tooltip="Select the futures pair for one you want to see funding rate")
typicalPrice_fut_1 = (request.security(ticker1fut, res, open) + request.security(ticker1fut, res, high) + request.security(ticker1fut, res, low) + request.security(ticker1fut, res, close)) / 4

src3 = typicalPrice_fut_1
len3 = input(defval=34)
offset3 = 0
out3 = ta.linreg(src3, len3, offset3)
diff1 = ((src3 - out3)/src3)

src5 = typicalPrice_fut_1
len5 = input(defval=89)
offset5 = 0
out5 = ta.linreg(src5, len5, offset5)
diff2 = ((src5 - out5)/src5)

src6 = typicalPrice_fut_1
len6 = input(defval=144)
offset6 = 0
out6 = ta.linreg(src6, len6, offset6)
diff3 = ((src3 - out6)/src3)

src7 = typicalPrice_fut_1
len7 = input(defval=233)
out7 = ta.linreg(src6, len7, offset6)
diff4 = ((src3 - out7)/src3)

src8 = typicalPrice_fut_1
len8 = input(defval=377)
out8 = ta.linreg(src8, len8, offset6)
diff5 = ((src3 - out8)/src3)



plot(diff1, title = "Diff 1",color = diff1 >= 0 ? color.rgb(54, 244, 101) : color.rgb(150, 50, 0))
plot(diff2, title = "Diff 2",color = diff2 >= 0 ? color.rgb(54, 244, 101) : color.rgb(150, 50, 0))
plot(diff3, title = "Diff 3",color = diff3 >= 0 ? color.rgb(54, 244, 101) : color.rgb(150, 50, 0))
plot(diff4, title = "Diff 4",color = diff4 >= 0 ? color.rgb(54, 244, 101) : color.rgb(150, 50, 0))
plot(diff5, title = "Diff 5",color = diff5 >= 0 ? color.rgb(54, 244, 101) : color.rgb(150, 50, 0))

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.