-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMovingAverages.pine
More file actions
39 lines (21 loc) · 1.25 KB
/
MovingAverages.pine
File metadata and controls
39 lines (21 loc) · 1.25 KB
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
31
32
33
34
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © voidrlm
//@version=5
indicator(title='VOIDRLM', shorttitle='Moving Averages', overlay=true)
enable_vwap = input(true, title='VWAP') ,
enable_1a = input(true, title='MA 1')
enable_1am = input.int(20, minval=1, title="Length")
enable_1b = input(true, title='MA 2 ')
enable_1bm = input.int(50, minval=1, title="Length")
enable_1c = input(true, title='MA 3 ')
enable_1cm = input.int(200, minval=1, title="Length")
exponential = input(false, title='Change To Exponential MA')
aselect1 = exponential ? ta.ema(close, enable_1am) : ta.sma(close, enable_1am)
aselect2 = exponential ? ta.ema(close, enable_1bm) : ta.sma(close, enable_1bm)
aselect3 = exponential ? ta.ema(close, enable_1cm) : ta.sma(close, enable_1cm)
plot(enable_1a ? aselect1 : na, color=color.new(#D3FF00, 0), linewidth=1)
plot(enable_1b ? aselect2 : na, color=color.new(#FF00B1, 0), linewidth=1)
plot(enable_1c ? aselect3 : na, color=color.new(#C80000, 0), linewidth=1)
vwapFunction = ta.vwap(hlc3)
vwapSecurity = request.security(syminfo.tickerid, '', vwapFunction)
plot(enable_vwap ? vwapSecurity : na, title='VWAP', color=color.new(color.orange, 50), linewidth=3, editable=true)