-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorb.pine
30 lines (21 loc) · 993 Bytes
/
orb.pine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © udayadds
strategy(title="ORB study", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 3)
up5on = input(true, title="5 mins orb high")
down5on = input(true, title="5 mins orb low")
is_newbar(res)=>
change(time(res)) != 0
adopt(r, s)=>
security(tickerid, r, s)
high_range = valuewhen(is_newbar("D"), high, 0)
low_range = valuewhen(is_newbar("D"), low, 0)
adopt_1 = adopt('60', high_range)
up5 = plot(adopt_1, title="high", color=#009911, linewidth=1)
adopt_2 = adopt('60', low_range)
down5 = plot(adopt_2, title="low", color=#ff0000, linewidth=1)
rsi = rsi(close, 14)
smaVol = sma(volume, 20)
strategy.entry(id="long", long=true, when=close>adopt_1 && rsi>60)
strategy.close(id="long", when=close<adopt_2)
strategy.entry(id="short", long=false, when=close<adopt_2 && rsi<40)
strategy.close(id="short", when=close>adopt_1)