Skip to content

Instantly share code, notes, and snippets.

@snapo
Created March 8, 2023 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snapo/6f599a24a164238b041a4ece3f36d69e to your computer and use it in GitHub Desktop.
Save snapo/6f599a24a164238b041a4ece3f36d69e to your computer and use it in GitHub Desktop.
Tradingview Bitcoin price prediction for bottoms and tops, Halfingcycles are considered to exponentially increase the movement of the crossover... Only works on a daily timeframe...
//@version=5
indicator(title="SatDrainageSystem", shorttitle="SDS", overlay=true, timeframe="", timeframe_gaps=true)
x = 117569600000
primedistance = 0.15 / 100
normalclose = close
tsince = timestamp("28 Nov 2012 00:00")
tbarclose = time_close
tdiffms = tsince - tbarclose
fullhalvings = math.floor(tdiffms / x)
tlasthalfing = tdiffms - (fullhalvings * x)
days = 1360 - 1*(math.floor(tlasthalfing / 86400000) + 1) // prevent division by 0
adjustfactor = 1.0
if days <= 463
adjustfactor := 1.4
else if days > 463 and days <= 909
adjustfactor := 0.9
else
adjustfactor := 1.2
adjustedclose = close * adjustfactor
length = input.int(210, minval=1)
ema1 = ta.ema(normalclose, length)
ema2 = ta.ema(ema1, length)
ema3 = ta.ema(ema2, length)
out = 3 * (ema1 - ema2) + ema3
out2 = out * (1 + primedistance * 50)
xlength = input.int(210, minval=1)
xema1 = ta.ema(adjustedclose, xlength)
xema2 = ta.ema(xema1, xlength)
xema3 = ta.ema(xema2, xlength)
xout = 3 * (xema1 - xema2) + xema3
xout2 = xout * (1 - primedistance * 50)
plot(out2, "BearMarketIfHigherThanGreen", color=#ff1c1c)
plot(xout2, "BullMarketIfHigherThanRed", color=#30ff29)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment