Advertisement
munkeefonix

BTC Historic Willy

May 15th, 2014
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. study("BTC Historic Willy", overlay=false, shorttitle="Willy")
  2.  
  3. // indicator created by: crinvestor
  4. // https://www.tradingview.com/u/CRInvestor/
  5. //
  6. // ported by: flibbr
  7. // https://www.tradingview.com/u/flibbr/
  8. //
  9. // pastebin:
  10. // http://pastebin.com/apvewFAw
  11. //
  12. // more info about the indicator here:
  13. // https://www.tradingview.com/v/h2lfl0gT/
  14. //
  15. // notes:
  16. // Click the "eye" button next to the primary security to hide it.
  17. // Set the indicator scale is set to "Right".
  18. // Right click on the right axis, and uncheck "Scale Series Only"
  19. //
  20. // This inicator will have issues on subdaily and daily charts.
  21. // Should be used on weekly and monthly charts
  22. //
  23. // updated May-15-2014
  24. //
  25. // gox data
  26. goxH=security("MTGOX:BTCUSD",period,high)
  27. goxL=security("MTGOX:BTCUSD",period,low)
  28. goxC=security("MTGOX:BTCUSD",period,close)
  29.  
  30. stampH=security("BITSTAMP:BTCUSD",period,high)
  31. stampL=security("BITSTAMP:BTCUSD",period,low)
  32. stampC=security("BITSTAMP:BTCUSD",period,close)
  33.  
  34. goxWeight = input(title="Gox Weight", type=float, defval=80, minval=0.001, maxval=100)
  35. stampWeight = input(title="Stamp Weight", type=float, defval=20, minval=0.001, maxval=100)
  36. totalWeight = goxWeight + stampWeight
  37.  
  38. // the time to start transitioning from gox to 100% stamp.
  39. // 1377 is Jan-6-2014
  40. // 1385 is Jan-15-2014 (default)
  41. // 1337 is about the ATH (coincidentally)
  42. // 1192 is July-5-2013
  43.  
  44. // value of the current day.
  45. day=max(time/(86400 * 1000) - 14700, 0)
  46.  
  47. // debug: plot the day value on the chart.
  48. //plot(day)
  49.  
  50. endStart = input(title="Gox Taper Start Day", type=integer, defval=1385, minval=700, maxval=1405) * 1.0
  51. endTime = 1407.0
  52. otherBegin = 694.0
  53.  
  54. ratio=max(min((day-endStart)/(endTime-endStart), 1), 0)
  55. invRatio=1-ratio
  56.  
  57. goxRatio=invRatio * (goxWeight / totalWeight)
  58. otherRatio=(stampWeight / totalWeight) + ratio * (goxWeight/totalWeight)
  59.  
  60. // debug: display the ratios on the chart.
  61. //plot(goxRatio, color=yellow)
  62. //plot(otherRatio, color=green)
  63.  
  64. // debug: show the range of weights on the primary ticker bar.
  65. //barcolor(ratio == 0 ? red : (ratio == 1 ? yellow : blue))
  66.  
  67. // debug: show range of data of stamp data used (before: red, mixed: blue, all: yellow)
  68. //barcolor(day < otherBegin ? red : (day > endTime ? yellow : blue))
  69.  
  70. h = day < otherBegin ? goxH : (day > endTime ? stampH : (goxH * goxRatio + stampH * otherRatio))
  71. l = day < otherBegin ? goxL : (day > endTime ? stampL : (goxL * goxRatio + stampL * otherRatio))
  72. c = day < otherBegin ? goxC : (day > endTime ? stampC : (goxC * goxRatio + stampC * otherRatio))
  73.  
  74. //-----------------------------------------------------
  75. // custom indicators below
  76. // Since this going to be overlayed onto a symbol that will likely use weekdays
  77. // daily indicators will need to be adjusted to run a little faster.
  78. // fullWeekRatio: 5/7 = 0.714285
  79. // currently this cannot be done since multiplying the input values converts the value from an int to a series.
  80. //
  81. //adjustIndicator=isdwm and not isdaily
  82. //da=adjustIndicator ? 0.714285 : 1.0
  83.  
  84. stampgoxhlc3 = (h+l+c)/3
  85.  
  86. length = input(21, minval=1)
  87. upper = highest(stampgoxhlc3,length)
  88. lower = lowest(stampgoxhlc3,length)
  89. out = 100 * (c - upper) / (upper - lower)
  90. src = out, len = input(13, minval=1, title="Length")
  91. out2 = ema(out, len)
  92. plot(out, color=green)
  93. plot(out2, title="EMA", color=red)
  94. band1 = hline(-20)
  95. band0 = hline(-80)
  96. fill(band1, band0)
  97. hline(-50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement