Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © lotekjunky
- //@version=5
- indicator( shorttitle = "RSI OB/OS on Chart", title = " LoTek - On Chart RSI OB/OS w Alerts ", overlay=true)
- // Settings
- rsi_len = input.int ( 13, title = " RSI Length ", inline = "1", group = "RSI Settings" )
- rsi_src = input.source ( close, title = "", inline = "1", group = "RSI Settings" )
- i_rsi_ob = input.int ( 75, title = "RSI Overbought", inline = "4", group = "Alert Settings" )
- i_rsi_os = input.int ( 25, title = "RSI Overbought", inline = "5", group = "Alert Settings" )
- // Maybe I'll get this figured out some day
- //i_char_ob = input.string ( "OB", title = "Overbought Symbol", inline = "1", group = "On Chart" )
- //i_char_os = input.string ( "OS", title = "Oversold Symbol", inline = "2", group = "On Chart" )
- //i_col_ob = input.color ( color.new(color.lime,50), title = "OB Symbol Color", inline = "3", group = "On Chart" )
- //i_col_os = input.color ( color.new(color.red,50), title = "OS Symbol Color", inline = "4", group = "On Chart" )
- // Do math and stuff
- rsi_val = ta.rsi(rsi_src, rsi_len)
- bl_rsi_ob = rsi_val >= i_rsi_ob
- bl_rsi_os = rsi_val <= i_rsi_os
- // Draw on chart
- plotshape(bl_rsi_ob, title='Overbought', location=location.abovebar, color=color.new(color.red,50), style=shape.triangledown, text='OB')
- plotshape(bl_rsi_os, title='OverSold', location=location.belowbar, color=color.new(color.lime,50), style=shape.triangledown, text='OS')
- // Alerts
- alertcondition( bl_rsi_ob, title='RSI Overbought', message='RSI OB')
- alertcondition( bl_rsi_os, title='RSI Oversold' , message='RSI OB')
Advertisement
Add Comment
Please, Sign In to add comment