Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study("BTC Historic Ichimoku", overlay=true)
- // author: munkeefonix
- // https://www.tradingview.com/u/munkeefonix/
- //
- // pastebin:
- // http://pastebin.com/ezrbb49D
- //
- // 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
- iCon=input(9, "Conversion", integer, minval=1)
- iTurn=input(26, "Turn", integer, minval=1)
- iLag=input(52, "Lag", integer, minval=1)
- iOff=input(26, "Displacement", integer, minval=1)
- ichiCon=(highest(h, iCon)+lowest(l, iCon)) / 2
- ichiBase=(highest(h, iTurn)+lowest(l, iTurn)) / 2
- senkouA=(ichiCon+ichiBase)/2
- senkouB=(highest(h, iLag)+lowest(l, iLag)) / 2
- plot(ichiCon, color=red, linewidth=1, title="Conversion Line")
- plot(ichiBase, color=purple, linewidth=1, title="Base Line")
- plot(c, color=yellow, linewidth=1, offset=-iOff, title="Lagging Span")
- sA = plot(senkouA, color=#999999, offset=iOff, title="Leading Span A", linewidth=1)
- sB = plot(senkouB, color=#999999, offset=iOff, title="Leading Span B", linewidth=2)
- fill(sA, sB, color=black, transp=90, title="Leading Fill Color")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement