Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study("BTC Historic RSI", overlay=false)
- // indicator created by: debani
- // https://www.tradingview.com/u/debani/
- //
- // pastebin:
- // http://pastebin.com/bJthxhXn
- //
- // more info about the indicator here:
- // https://www.tradingview.com/v/h2lfl0gT/
- //
- // notes:
- // Click the "eye" button next to the primary security to hide it.
- // Set the indicator scale is set to "Right".
- // Right click on the right axis, and uncheck "Scale Series Only"
- //
- // This inicator will have issues on subdaily and daily charts.
- // Should be used on weekly and monthly charts
- //
- // updated May-15-2014
- //
- // gox data
- goxH=security("MTGOX:BTCUSD",period,high)
- goxL=security("MTGOX:BTCUSD",period,low)
- goxC=security("MTGOX:BTCUSD",period,close)
- stampH=security("BITSTAMP:BTCUSD",period,high)
- stampL=security("BITSTAMP:BTCUSD",period,low)
- stampC=security("BITSTAMP:BTCUSD",period,close)
- goxWeight = input(title="Gox Weight", type=float, defval=80, minval=0.001, maxval=100)
- stampWeight = input(title="Stamp Weight", type=float, defval=20, minval=0.001, maxval=100)
- totalWeight = goxWeight + stampWeight
- // the time to start transitioning from gox to 100% stamp.
- // 1377 is Jan-6-2014
- // 1385 is Jan-15-2014 (default)
- // 1337 is about the ATH (coincidentally)
- // 1192 is July-5-2013
- // value of the current day.
- day=max(time/(86400 * 1000) - 14700, 0)
- // debug: plot the day value on the chart.
- //plot(day)
- endStart = input(title="Gox Taper Start Day", type=integer, defval=1385, minval=700, maxval=1405) * 1.0
- endTime = 1407.0
- otherBegin = 694.0
- ratio=max(min((day-endStart)/(endTime-endStart), 1), 0)
- invRatio=1-ratio
- goxRatio=invRatio * (goxWeight / totalWeight)
- otherRatio=(stampWeight / totalWeight) + ratio * (goxWeight/totalWeight)
- // debug: display the ratios on the chart.
- //plot(goxRatio, color=yellow)
- //plot(otherRatio, color=green)
- // debug: show the range of weights on the primary ticker bar.
- //barcolor(ratio == 0 ? red : (ratio == 1 ? yellow : blue))
- // debug: show range of data of stamp data used (before: red, mixed: blue, all: yellow)
- //barcolor(day < otherBegin ? red : (day > endTime ? yellow : blue))
- h = day < otherBegin ? goxH : (day > endTime ? stampH : (goxH * goxRatio + stampH * otherRatio))
- l = day < otherBegin ? goxL : (day > endTime ? stampL : (goxL * goxRatio + stampL * otherRatio))
- c = day < otherBegin ? goxC : (day > endTime ? stampC : (goxC * goxRatio + stampC * otherRatio))
- //-----------------------------------------------------
- // custom indicators below
- // Since this going to be overlayed onto a symbol that will likely use weekdays
- // daily indicators will need to be adjusted to run a little faster.
- // fullWeekRatio: 5/7 = 0.714285
- // currently this cannot be done since multiplying the input values converts the value from an int to a series.
- //
- //adjustIndicator=isdwm and not isdaily
- //da=adjustIndicator ? 0.714285 : 1.0
- src = c
- len = input(14, minval=1, title="Length")
- up = ema(max(change(src), 0), len)
- down = ema(-min(change(src), 0), len)
- rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
- plot(rsi, color=purple)
- band1 = hline(70)
- band0 = hline(30)
- fill(band1, band0, color=purple, transp=90)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement