-
Notifications
You must be signed in to change notification settings - Fork 16
/
greeffer-rsi.pine
23 lines (19 loc) · 911 Bytes
/
greeffer-rsi.pine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Greeffer
//@version=4
strategy(title="Greeffer RSI Strategy", shorttitle="GRsi", overlay=false)
// R S I
myRsi = rsi(close, 14)
plot(myRsi, title="myRsi", color=color.blue, linewidth=2, style=plot.style_line, transp=70)
hline(29, title='oversold', color=color.red, linestyle=hline.style_dotted, linewidth=1)
hline(70, title='overbought', color=color.red, linestyle=hline.style_dotted, linewidth=1)
// L o n g C o n d i t i o n
longCondition = myRsi <= 29
if (longCondition)
strategy.entry("RsiBuy", strategy.long)
alertcondition(longCondition, title='Buy Rsi', message='Rsi={{myRsi}}')
// S h o r t C o n d i t i o n
shortCondition = myRsi >= 70
if (shortCondition)
strategy.entry("RsiSell", strategy.short)
alertcondition(shortCondition, title='Sell Rsi', message='Rsi={{myRsi}}')