Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(title="RSI historic btc", shorttitle="RSI")
- 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=50, minval=0.001, maxval=100)
- stampWeight = input(title="Stamp Weight", type=float, defval=50, minval=0.001, maxval=100)
- totalWeight = goxWeight + stampWeight
- endStart = input(title="BlendStart", type=integer, defval=13900, minval=13300, maxval=13910) * 100000000 //1385000000000.0
- endTime = 1391726400000.0
- otherBegin = 1330000000000.0
- ratio=max(min((time-endStart)/(endTime-endStart), 1),0)
- invRatio=1-ratio
- goxRatio=invRatio * (goxWeight/totalWeight)
- otherRatio=(stampWeight/totalWeight)+ratio* (goxWeight/totalWeight)
- barcolor(ratio == 0 ? red : (ratio == 1 ? yellow : blue))
- h = time < otherBegin ? goxH : (time > endTime ? stampH : (goxH * goxRatio + stampH * otherRatio))
- l = time < otherBegin ? goxL : (time > endTime ? stampL : (goxL * goxRatio + stampL * otherRatio))
- c = time < otherBegin ? goxC : (time > endTime ? stampC : (goxC * goxRatio + stampC * otherRatio))
- 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