Last active
March 6, 2022 11:52
-
-
Save kuldeepkeshwar/97488e4fbfc035a527b69f59065900de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//developed by @kuldeepkeshwar | |
//@version=5 | |
indicator(title='SMA/EMA/RSI Signal', overlay=true) | |
// ema | |
emaInput1=input.int(55,title="value",group="EMA 1", inline="EMA 1") | |
emaInput2=input.int(100,title="value",group="EMA 2", inline="EMA 2") | |
emaInput3=input.int(200,title="value",group="EMA 3", inline="EMA 3") | |
emaInput4=input.int(300,title="value",group="EMA 4", inline="EMA 4") | |
emaColor1=input.color(color.white, title="color",group="EMA 1", inline="EMA 1") | |
emaColor2=input.color(color.yellow, title="color",group="EMA 2", inline="EMA 2") | |
emaColor3=input.color(color.purple, title="color",group="EMA 3", inline="EMA 3") | |
emaColor4=input.color(color.orange, title="color",group="EMA 4", inline="EMA 4") | |
emaOnOff1=input.bool(true,title="Show",group="EMA 1", inline="EMA 1") | |
emaOnOff2=input.bool(true,title="Show",group="EMA 2", inline="EMA 2") | |
emaOnOff3=input.bool(true,title="Show",group="EMA 3", inline="EMA 3") | |
emaOnOff4=input.bool(true,title="Show",group="EMA 4", inline="EMA 4") | |
plot(emaOnOff1?ta.ema(close, emaInput1):na, 'EMA 1', emaColor1, 1, plot.style_stepline) | |
plot(emaOnOff2?ta.ema(close, emaInput2):na, 'EMA 2', emaColor2, 1, plot.style_stepline) | |
plot(emaOnOff3?ta.ema(close, emaInput3):na, 'EMA 3', emaColor3, 1, plot.style_stepline) | |
plot(emaOnOff4?ta.ema(close, emaInput4):na, 'EMA 4', emaColor4, 1, plot.style_stepline) | |
// sma | |
smaInput1=input.int(55,title="value",group="SMA 1", inline="SMA 1") | |
smaInput2=input.int(100,title="value",group="SMA 2", inline="SMA 2") | |
smaInput3=input.int(200,title="value",group="SMA 3", inline="SMA 3") | |
smaInput4=input.int(300,title="value",group="SMA 4", inline="SMA 4") | |
smaColor1=input.color(color.white, title="color",group="SMA 1", inline="SMA 1") | |
smaColor2=input.color(color.yellow, title="color",group="SMA 2", inline="SMA 2") | |
smaColor3=input.color(color.purple, title="color",group="SMA 3", inline="SMA 3") | |
smaColor4=input.color(color.orange, title="color",group="SMA 4", inline="SMA 4") | |
smaOnOff1=input.bool(true,title="Show",group="SMA 1", inline="SMA 1") | |
smaOnOff2=input.bool(true,title="Show",group="SMA 2", inline="SMA 2") | |
smaOnOff3=input.bool(true,title="Show",group="SMA 3", inline="SMA 3") | |
smaOnOff4=input.bool(true,title="Show",group="SMA 4", inline="SMA 4") | |
plot(smaOnOff1?ta.sma(close, smaInput1):na, 'SMA 1', smaColor1) | |
plot(smaOnOff2?ta.sma(close, smaInput2):na, 'SMA 2', smaColor2) | |
plot(smaOnOff3?ta.sma(close, smaInput3):na, 'SMA 3', smaColor3) | |
plot(smaOnOff4?ta.sma(close, smaInput4):na, 'SMA 4', smaColor4) | |
// Get user input for RSI | |
rsiSource = input.source(close,"Source", group="RSI",inline="rsi") | |
rsiLength = input.int(14,"Length", group="RSI",inline="rsi") | |
rsiSignalOnOff=input.bool(true,title="Show",group="RSI",inline="rsi") | |
rsiOverbought = input.int(80,"Overbought", group="RSI",inline="rsi_levels") | |
rsiOversold = input.int(20,"Oversold", group="RSI",inline="rsi_levels") | |
rsiValue = ta.rsi(rsiSource, rsiLength) | |
isRsiOB = rsiValue >= rsiOverbought | |
isRsiOS = rsiValue <= rsiOversold | |
plotshape(rsiSignalOnOff and isRsiOB, title="Overbought", location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, text="sell") | |
plotshape(rsiSignalOnOff and isRsiOS, title="Oversold", location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup,text="buy") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment