Guest User

Value Chart [TMC]

a guest
Apr 20th, 2015
733
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Created by TheMightyChicken
  2. // Based on LazyBear's Value Chart
  3. study("Value Chart [TMC]", shorttitle="VC")
  4. // Inputs
  5. Over = input(true, title="Use colored candles for OB/OS?")
  6. Classic = input(false, title="Use classic color scheme?")
  7. extOB = input(12, title="Extremely OB/OS")
  8. sigOB = input(8, title="Significantly OB/OS")
  9. modOB = input(4, title="Moderately OB/OS")
  10. extOS = extOB*(-1), sigOS = sigOB*(-1), modOS = modOB*(-1)
  11. // Indicator Calculations
  12. middle = (((high+low)/2)+((high[1]+low[1])/2)+((high[2]+low[2])/2)+((high[3]+low[3])/2)+((high[4]+low[4])/2))/5
  13. scale = (((high-low)+(high[1]-low[1])+(high[2]-low[2])+(high[3]-low[3])+(high[4]-low[4]))/5)*0.2
  14. o = (open-middle)/scale
  15. c = (close-middle)/scale
  16. h = (high-middle)/scale
  17. l = (low-middle)/scale
  18. // Body Calculation
  19. bh = o>c ? o : c
  20. bl = o<c ? o : c
  21. b0 = (o>0 and c>0) or (o>0 and c<0) ? bh : (o<0 and c<0) or (o<0 and c>0) ? bl : 0
  22. b1 = o<0 and c>0 ? bh : o>0 and c<0 ? bl : 0
  23. bc0 = o>0 and c>0 ? bl : o<0 and c<0 ? bh : 0
  24. // Wick Calculations
  25. w0 = h>0 ? h : l
  26. w1 = h>0 and l<0 ? l : h
  27. wc = h>0 and l>0 ? l : h<0 and l<0 ? h : 0
  28. // Colors
  29. Overbought = lime
  30. Oversold = red
  31. Fair = silver
  32. Candles = Over and c>sigOB ? Overbought : Over and c<sigOS ? Oversold : Classic and o>c ? #C76B66 : Classic and o<c ? #6BA583 : Fair
  33. bg = white // <= change to your background's color
  34. bgcolor(bg, transp=0)
  35. // Lines
  36. extOb = plot(extOB, linewidth=2, color=Overbought, title="Extremely Overbought")
  37. sigOb = plot(sigOB, color=Overbought, title="Significantly Overbought"), plot(sigOB, linewidth=1, color=bg, style=circles)
  38. modOb = plot(modOB, color=Fair, title="Moderately Overbought"), plot(modOB+1, linewidth=7, color=bg, style=histogram)
  39. zero = plot(0, color=blue, title="Zero Line"), plot(1, linewidth=5, color=bg, style=histogram)
  40. modOs = plot(modOS, color=Fair, title="Moderately Oversold"), plot(modOS-1, linewidth=7, color=bg, style=histogram)
  41. sigOs = plot(sigOS, color=Oversold, title="Significantly Oversold"), plot(sigOS, linewidth=1, color=bg, style=circles)
  42. extOs = plot(extOS, linewidth=2, color=Oversold, title="Extremely Oversold")
  43. fill(sigOb, sigOs, silver, transp=80)
  44. // Candles
  45. plot(b0, linewidth=3, color=Candles, style=histogram, title="Body")
  46. plot(b1, linewidth=3, color=Candles, style=histogram, title="Body")
  47. plot(bc0, linewidth=3, color=bg, style=histogram, title="Cover layer")
  48. plot(w0, linewidth=1, color=Candles, style=histogram, title="Wick")
  49. plot(w1, linewidth=1, color=Candles, style=histogram, title="Wick")
  50. plot(wc, linewidth=1, color=bg, style=histogram, title="Cover layer")
RAW Paste Data