Intraday JXMODI Cross
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Jxmodi

//@version=4
study(title="Intraday JXMODI Cross", shorttitle="JxCross",precision=1)
len1 = input(title="MA 1", defval = 15)
len2 = input(title="MA 1", defval = 43)

h1 = hline(45.)
h2 = hline(50.)
h3 = hline(55.)
fill(h1, h3, color = color.new(color.gray, 95))
sh = rsi(close, len1)
ln = sma(sh, len2)

p1 = plot(sh, color = color.black)
p2 = plot(ln, color = color.red)
mycol = sh > ln ? color.green : color.fuchsia
fill(p1, p2, color = mycol)

buy = (sh[1] < ln[1] and sh > ln) 
sell = (sh[1] > ln[1] and sh < ln)
alertcondition(buy, title='Buy', message='JxCross. Buy Signal')
alertcondition(sell, title='Sell', message='JxCross. Sell Signal')
