Advertisement
Guest User

Untitled

a guest
May 14th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. study(title="RSI historic btc", shorttitle="RSI")
  2.  
  3. goxH=security("MTGOX:BTCUSD",period,high)
  4. goxL=security("MTGOX:BTCUSD",period,low)
  5. goxC=security("MTGOX:BTCUSD",period,close)
  6. stampH=security("BITSTAMP:BTCUSD",period,high)
  7. stampL=security("BITSTAMP:BTCUSD",period,low)
  8. stampC=security("BITSTAMP:BTCUSD",period,close)
  9. goxWeight = input(title="Gox Weight", type=float, defval=50, minval=0.001, maxval=100)
  10. stampWeight = input(title="Stamp Weight", type=float, defval=50, minval=0.001, maxval=100)
  11. totalWeight = goxWeight + stampWeight
  12. endStart = input(title="BlendStart", type=integer, defval=13900, minval=13300, maxval=13910) * 100000000 //1385000000000.0
  13. endTime = 1391726400000.0
  14. otherBegin = 1330000000000.0
  15. ratio=max(min((time-endStart)/(endTime-endStart), 1),0)
  16. invRatio=1-ratio
  17. goxRatio=invRatio * (goxWeight/totalWeight)
  18. otherRatio=(stampWeight/totalWeight)+ratio* (goxWeight/totalWeight)
  19. barcolor(ratio == 0 ? red : (ratio == 1 ? yellow : blue))
  20. h = time < otherBegin ? goxH : (time > endTime ? stampH : (goxH * goxRatio + stampH * otherRatio))
  21. l = time < otherBegin ? goxL : (time > endTime ? stampL : (goxL * goxRatio + stampL * otherRatio))
  22. c = time < otherBegin ? goxC : (time > endTime ? stampC : (goxC * goxRatio + stampC * otherRatio))
  23.  
  24. src = c
  25. len = input(14, minval=1, title="Length")
  26. up = ema(max(change(src), 0), len)
  27. down = ema(-min(change(src), 0), len)
  28. rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
  29. plot(rsi, color=purple)
  30. band1 = hline(70)
  31. band0 = hline(30)
  32. fill(band1, band0, color=purple, transp=90)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement