Advertisement
Guest User

Untitled

a guest
Nov 24th, 2019
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. //@version=4
  2. // Taken from the TradingView house rules regarding scripts:
  3.  
  4. // "All open source scripts that do not mention a specific open source license
  5. // in their comments are licensed under the Mozilla Public License 2.0.
  6. // Following the Mozilla License, any script reusing open source code originally
  7. // published by someone else must also be open source, unless specific
  8. // permission is granted by the original author."
  9.  
  10. // Rhapsodyy's Combo SMA's v1.1
  11.  
  12. // SMA's with Painted Labels : 10/30/50/80/200
  13. //
  14. // 50SMA / 200SMA Golden & Death Crosses on Current Timeframe & Alerts
  15. // Daily 50SMA / 200SMA Golden & Death Crosses overlayed onto Current Timeframe & Alerts
  16. //
  17. // Have listed color codes also.
  18. //
  19. // Simple Moving Averages (SMA):
  20. // These can be changed to any figures or colors you may prefer to use.
  21. // And can be individually or as a whole group turned on and off through settings.
  22. // 10 - Purple - #8A2BE2
  23. // 30 - Cyan - #00FFFF
  24. // 50 - Olive - #556B2F
  25. // 80 - Gold - #DAA520
  26. // 200 - Maroon - #800000
  27. //
  28. // Donations if you should so feel inclined: BTC - 3Ec8FaLMr2surCWNkTaZWs4jH7UijX8CHT
  29. //
  30. // Discord Server : https://discord.gg/xmxJDXw
  31. // A server i set up for me and a few freinds recently to chat Trading and TA,
  32. // feel free to join if you're the type that likes a chat and isnt just going to
  33. // lurk around in the shadows :)
  34.  
  35. study(title="Rhaps SMA Combo v1.1", shorttitle="RCSMA v1.1", overlay=true)
  36.  
  37. showSMA1 = input(title="SMA's- 10/30/50/80/200", defval=false)
  38. showSMATFGDX = input(title='Current TF 50/200 SMA G&D X', defval=false)
  39. showSMADGDX2 = input(title='Daily 50SMA/200SMA G&D X', defval=false)
  40. showSMA1Labels = input(title="SMA Labels", defval=true)
  41.  
  42.  
  43. //Simple Moving Averages: 10/30/50/80/200
  44. sma10 = sma(close, 10)
  45. sma30 = sma(close, 30)
  46. sma50 = sma(close, 50)
  47. sma80 = sma(close, 80)
  48. sma200 = sma(close, 200)
  49. plot(showSMA1 == true ? sma10 : na, color=#8A2BE2, transp=0, linewidth=1, title='SMA 10')
  50. plot(showSMA1 == true ? sma30 : na, color=#00FFFF, transp=0, linewidth=1, title='SMA 30')
  51. plot(showSMA1 == true ? sma50 : na, color=#556B2F, transp=0, linewidth=1, title='SMA 50')
  52. plot(showSMA1 == true ? sma80 : na, color=#DAA520, transp=0, linewidth=1, title='SMA 80')
  53. plot(showSMA1 == true ? sma200 : na, color=#800000, transp=0, linewidth=1, title='SMA 200')
  54.  
  55. // SMA Labels
  56. plotshape(showSMA1 == true and showSMA1Labels == true ? sma10 : na, style=shape.diamond, location=location.absolute, show_last=1, color=#8A2BE2, transp=0, text="SMA 10", title='SMA 10', offset=10)
  57. plotshape(showSMA1 == true and showSMA1Labels == true ? sma30 : na, style=shape.diamond, location=location.absolute, show_last=1, color=#00FFFF, transp=0, text='SMA 30', title='SMA 30', offset=10)
  58. plotshape(showSMA1 == true and showSMA1Labels == true ? sma50 : na, style=shape.diamond, location=location.absolute, show_last=1, color=#556B2F, transp=0, text='SMA 50', title='SMA 50', offset=10)
  59. plotshape(showSMA1 == true and showSMA1Labels == true ? sma80 : na, style=shape.diamond, location=location.absolute, show_last=1, color=#DAA520, transp=0, text='SMA 80', title='SMA 80', offset=10)
  60. plotshape(showSMA1 == true and showSMA1Labels == true ? sma200 : na, style=shape.diamond, location=location.absolute, show_last=1, color=#800000, transp=0, text='SMA 200', title='SMA 200', offset=10)
  61.  
  62. //Current TF Golden & Death Cross: 50SMA & 200SMA
  63. smagoldenx = crossover(sma50, sma200) and not timeframe.isweekly and not timeframe.ismonthly
  64. smadeathx = crossunder(sma50, sma200) and not timeframe.isweekly and not timeframe.ismonthly
  65. plotshape(showSMATFGDX == true ? smagoldenx : na, style=shape.xcross, location=location.belowbar, color=#00ff00, transp=0, text='GX SMA\n50/200', title='50/200 SMA Golden X', show_last=500, size=size.small)
  66. plotshape(showSMATFGDX == true ? smadeathx : na, style=shape.xcross, location=location.abovebar, color=#ff9200, transp=0, text='DX SMA\n50/200', title='50/200 SMA Death X', show_last=500, size=size.small)
  67. alertcondition(smagoldenx, title='50/200 SMA Golden X', message='50/200 SMA Golden X')
  68. alertcondition(smadeathx, title='50/200 SMA Death X', message='50/200 SMA Death X')
  69.  
  70. //Daily Golden & Death Cross: 50SMA & 200SMA
  71. sma50_1d = security(syminfo.tickerid, 'D', sma50)
  72. sma200_1d = security(syminfo.tickerid, 'D', sma200)
  73. smagoldenx_1db = crossover(sma50_1d, sma200_1d) and not timeframe.isweekly and not timeframe.ismonthly
  74. smadeathx_1db = crossunder(sma50_1d, sma200_1d) and not timeframe.isweekly and not timeframe.ismonthly
  75. plotshape(showSMADGDX2 == true ? smagoldenx_1db : na, style=shape.xcross, location=location.belowbar, color=#ffe500, transp=0, text='1DGX SMA\n50/200', title='1D 50EMA/200SMA Golden X', show_last=300, size=size.normal)
  76. plotshape(showSMADGDX2 == true ? smadeathx_1db : na, style=shape.xcross, location=location.abovebar, color=#ff0000, transp=0, text='1DDX SMA\n50/200', title='1D 50EMA/200SMA Death X', show_last=300, size=size.normal)
  77. alertcondition(smagoldenx_1db, title='1D 50SMA/200SMA Golden X', message='1D 50SMA/200SMA Golden X')
  78. alertcondition(smadeathx_1db, title='1D 50SMA/200SMA Death X', message='1D 50SMA/200SMA Death X')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement