Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- // Taken from the TradingView house rules regarding scripts:
- // "All open source scripts that do not mention a specific open source license
- // in their comments are licensed under the Mozilla Public License 2.0.
- // Following the Mozilla License, any script reusing open source code originally
- // published by someone else must also be open source, unless specific
- // permission is granted by the original author."
- // Rhapsodyy's Combo SMA's v1.1
- // SMA's with Painted Labels : 10/30/50/80/200
- //
- // 50SMA / 200SMA Golden & Death Crosses on Current Timeframe & Alerts
- // Daily 50SMA / 200SMA Golden & Death Crosses overlayed onto Current Timeframe & Alerts
- //
- // Have listed color codes also.
- //
- // Simple Moving Averages (SMA):
- // These can be changed to any figures or colors you may prefer to use.
- // And can be individually or as a whole group turned on and off through settings.
- // 10 - Purple - #8A2BE2
- // 30 - Cyan - #00FFFF
- // 50 - Olive - #556B2F
- // 80 - Gold - #DAA520
- // 200 - Maroon - #800000
- //
- // Donations if you should so feel inclined: BTC - 3Ec8FaLMr2surCWNkTaZWs4jH7UijX8CHT
- //
- // Discord Server : https://discord.gg/xmxJDXw
- // A server i set up for me and a few freinds recently to chat Trading and TA,
- // feel free to join if you're the type that likes a chat and isnt just going to
- // lurk around in the shadows :)
- study(title="Rhaps SMA Combo v1.1", shorttitle="RCSMA v1.1", overlay=true)
- showSMA1 = input(title="SMA's- 10/30/50/80/200", defval=false)
- showSMATFGDX = input(title='Current TF 50/200 SMA G&D X', defval=false)
- showSMADGDX2 = input(title='Daily 50SMA/200SMA G&D X', defval=false)
- showSMA1Labels = input(title="SMA Labels", defval=true)
- //Simple Moving Averages: 10/30/50/80/200
- sma10 = sma(close, 10)
- sma30 = sma(close, 30)
- sma50 = sma(close, 50)
- sma80 = sma(close, 80)
- sma200 = sma(close, 200)
- plot(showSMA1 == true ? sma10 : na, color=#8A2BE2, transp=0, linewidth=1, title='SMA 10')
- plot(showSMA1 == true ? sma30 : na, color=#00FFFF, transp=0, linewidth=1, title='SMA 30')
- plot(showSMA1 == true ? sma50 : na, color=#556B2F, transp=0, linewidth=1, title='SMA 50')
- plot(showSMA1 == true ? sma80 : na, color=#DAA520, transp=0, linewidth=1, title='SMA 80')
- plot(showSMA1 == true ? sma200 : na, color=#800000, transp=0, linewidth=1, title='SMA 200')
- // SMA Labels
- 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)
- 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)
- 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)
- 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)
- 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)
- //Current TF Golden & Death Cross: 50SMA & 200SMA
- smagoldenx = crossover(sma50, sma200) and not timeframe.isweekly and not timeframe.ismonthly
- smadeathx = crossunder(sma50, sma200) and not timeframe.isweekly and not timeframe.ismonthly
- 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)
- 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)
- alertcondition(smagoldenx, title='50/200 SMA Golden X', message='50/200 SMA Golden X')
- alertcondition(smadeathx, title='50/200 SMA Death X', message='50/200 SMA Death X')
- //Daily Golden & Death Cross: 50SMA & 200SMA
- sma50_1d = security(syminfo.tickerid, 'D', sma50)
- sma200_1d = security(syminfo.tickerid, 'D', sma200)
- smagoldenx_1db = crossover(sma50_1d, sma200_1d) and not timeframe.isweekly and not timeframe.ismonthly
- smadeathx_1db = crossunder(sma50_1d, sma200_1d) and not timeframe.isweekly and not timeframe.ismonthly
- 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)
- 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)
- alertcondition(smagoldenx_1db, title='1D 50SMA/200SMA Golden X', message='1D 50SMA/200SMA Golden X')
- 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