// This source code is subject to the terms of the Mozilla Public License 2.
0 at
[Link]
// © vishva989
//@version=5
strategy("My strategy", overlay=true, margin_long=100, margin_short=100)
ma(source, length, type) =>
switch type
"SMA" => [Link](source, length)
"Bollinger Bands" => [Link](source, length)
"EMA" => [Link](source, length)
"SMMA (RMA)" => [Link](source, length)
"WMA" => [Link](source, length)
"VWMA" => [Link](source, length)
rsiLengthInput = [Link](14, minval=1, title="RSI Length", group="RSI Settings")
rsitLengthInput = [Link](14, minval=1, title="RSIT Length", group="RSI
Settings")
rsiSourceInput = [Link](close, "Source", group="RSI Settings")
rsitSourceInput = [Link](close, "Source", group="RSI Settings")
oversold= [Link](30,minval=1, title="OverSold", group="RSI Settings")
overbought= [Link](70,minval=1, title="OverBought", group="RSI Settings")
maTypeInput = [Link]("SMA", title="MA Type", options=["SMA", "Bollinger
Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings")
maLengthInput = [Link](14, title="MA Length", group="MA Settings")
up = [Link]([Link]([Link](rsiSourceInput), 0), rsiLengthInput)
down = [Link](-[Link]([Link](rsiSourceInput), 0), rsiLengthInput)
upt = [Link]([Link]([Link](rsitSourceInput), 0), rsitLengthInput)
downt = [Link](-[Link]([Link](rsitSourceInput), 0), rsitLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsit = downt == 0 ? 100 : upt == 0 ? 0 : 100 - (100 / (1 + upt / downt))
rsiMA = ma(rsi, maLengthInput, maTypeInput)
//plot(rsi,color=[Link])
//plot(rsit,color=[Link])
longCondition = [Link](rsi,overbought)
if (longCondition)
[Link]("My Long Entry Id", [Link],100)
shortCondition =[Link](rsi, overbought)
if (shortCondition)
[Link]("My Short Entry Id", [Link],100)