Created
February 12, 2021 23:38
-
-
Save jamesray1/b396b87cae4517c426755743a7e47ae2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=4 | |
// | |
// @author jcray | |
// Bitcoin Top, Mid and Bottom Cap Bands. Modified originally from Bitcoin Top/Average Cap scripts by aamonkey, and then from the ETH Cap Bands script. | |
// | |
study("BTC Top, Mid and Bottom Cap Bands [jcray]",shorttitle="BTC Cap Bands [jcr]", overlay=true) | |
mulTop = input(35, title = "Multiplier") | |
mulBottom = input(0.5, title = "Average Multiplier") | |
mulMid = avg(mulTop,mulBottom) | |
launchYear = input(2009, title = "Launch Year") | |
launchMonth = input(01, title = "Launch Month") | |
launchDay = input(03, title = "Launch Day") | |
//Getting start of chart | |
date = valuewhen(bar_index==0, time, 0) | |
//Converting start of chart | |
secondsRaw = floor(date/ 1000) | |
minutesRaw = floor(secondsRaw / 60) | |
hoursRaw = floor(minutesRaw / 60) | |
daysRaw = floor(hoursRaw / 24) | |
//Launch timestamp of the ticker's network (ETH, BTC, etc.) | |
launchTimestampTicker = timestamp(launchYear,launchMonth,launchDay,00,00) | |
secondsRawB = floor(launchTimestampTicker / 1000) | |
minutesRawB = floor(secondsRawB / 60) | |
hoursRawB = floor(minutesRawB / 60) | |
daysRawB = floor(hoursRawB / 24) | |
//Calculation | |
difference = daysRaw - daysRawB | |
bottom = cum(close)/(difference+bar_index+1) | |
mod_bottom = mulBottom*bottom | |
mid = mulMid*bottom | |
top = mulTop*bottom | |
//Plot | |
plot(bottom, title="Bottom Cap", color = color.blue, linewidth = 3) | |
plot(mid, title="Mid Cap", color = color.yellow, linewidth = 3) | |
plot(top, title="Top Cap", color = color.red, linewidth = 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment