jcray

ETH Cap Bands

Feb 12th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. //@version=4
  2. //
  3. // @author jcray
  4. // ETH Top, Mid and Bottom Cap Bands. Modified from Bitcoin Top/Average Cap scripts by aamonkey
  5. //
  6. study("ETH Top, Mid and Bottom Cap Bands [jcray]",shorttitle="ETH Cap Bands [jcr]", overlay=true)
  7.  
  8. //input
  9. mulTop = input(12.9, title = "Top Multiplier")
  10. mulBottom = input(0.5, title = "Average Multiplier")
  11. mulMid = avg(mulTop,mulBottom)
  12. launchYear = input(2015, title = "Launch Year")
  13. launchMonth = input(07, title = "Launch Month")
  14. launchDay = input(30, title = "Launch Day")
  15.  
  16. //Getting start of chart
  17. date = valuewhen(bar_index==0, time, 0)
  18.  
  19. //Converting start of chart
  20. secondsRaw = floor(date/ 1000)
  21. minutesRaw = floor(secondsRaw / 60)
  22. hoursRaw = floor(minutesRaw / 60)
  23. daysRaw = floor(hoursRaw / 24)
  24.  
  25. //Launch timestamp of the ticker's network (ETH, BTC, etc.)
  26. launchTimestampTicker = timestamp(launchYear,launchMonth,launchDay,00,00)
  27. secondsRawB = floor(launchTimestampTicker / 1000)
  28. minutesRawB = floor(secondsRawB / 60)
  29. hoursRawB = floor(minutesRawB / 60)
  30. daysRawB = floor(hoursRawB / 24)
  31.  
  32. //Calculation
  33. difference = daysRaw - daysRawB
  34. bottom = cum(close)/(difference+bar_index+1)
  35. mod_bottom = mulBottom*bottom
  36. mid = mulMid*bottom
  37. top = mulTop*bottom
  38.  
  39. //Plot
  40. plot(mod_bottom, title="Bottom Cap", color = color.blue, linewidth = 3)
  41. plot(mid, title="Mid Cap", color = color.yellow, linewidth = 3)
  42. plot(top, title="Top Cap", color = color.red, linewidth = 3)
Add Comment
Please, Sign In to add comment