-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathVWAP
422 lines (381 loc) · 38.5 KB
/
VWAP
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
//@version=6
indicator(title = '✘', shorttitle = '✘', overlay = true, max_bars_back = 5000, max_polylines_count = 100, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500)
VWAP_Ctl = 'VWAP'
// VWAP #1 Settings
VWAP1_Settings = 'VWAP #1 Settings'
VWAP1_Ctl = input(false, title = '', group = VWAP_Ctl, inline = VWAP1_Settings, display = display.data_window)
Anchor1 = input.string(defval = 'Quarter', title = '', group = VWAP_Ctl, inline = VWAP1_Settings, options = ['Day', 'Week', 'Month', 'Quarter', 'Year'])
VWAP1_Col = input.color(defval = color.rgb(255, 183, 77, 60), title = 'VWAP', group = VWAP_Ctl, inline = VWAP1_Settings)
Bands1_Col = input.color(defval = color.rgb(255, 183, 77, 60), title = 'Bands', group = VWAP_Ctl, inline = VWAP1_Settings)
VWAP1_Bgc = input.color(defval = color.rgb(255, 183, 77, 95), title = 'Fill', group = VWAP_Ctl, inline = VWAP1_Settings)
// VWAP #2 Settings
VWAP2_Settings = 'VWAP #2 Settings'
VWAP2_Ctl = input(false, title = '', group = VWAP_Ctl, inline = VWAP2_Settings, display = display.data_window)
Anchor2 = input.string(defval = 'Month', title = '', group = VWAP_Ctl, inline = VWAP2_Settings, options = ['Day', 'Week', 'Month', 'Quarter', 'Year'])
VWAP2_Col = input.color(defval = color.rgb(91, 156, 246, 60), title = 'VWAP', group = VWAP_Ctl, inline = VWAP2_Settings)
Bands2_Col = input.color(defval = color.rgb(91, 156, 246, 60), title = 'Bands', group = VWAP_Ctl, inline = VWAP2_Settings)
VWAP2_Bgc = input.color(defval = color.rgb(91, 156, 246, 95), title = 'Fill', group = VWAP_Ctl, inline = VWAP2_Settings)
// VWAP #3 Settings
VWAP3_Settings = 'VWAP #3 Settings'
VWAP3_Ctl = input(false, title = '', group = VWAP_Ctl, inline = VWAP3_Settings, display = display.data_window)
Anchor3 = input.string(defval = 'Week', title = '', group = VWAP_Ctl, inline = VWAP3_Settings, options = ['Day', 'Week', 'Month', 'Quarter', 'Year'])
VWAP3_Col = input.color(defval = color.rgb(133, 227, 167, 60), title = 'VWAP', group = VWAP_Ctl, inline = VWAP3_Settings)
Bands3_Col = input.color(defval = color.rgb(133, 227, 167, 60), title = 'Bands', group = VWAP_Ctl, inline = VWAP3_Settings)
VWAP3_Bgc = input.color(defval = color.rgb(133, 227, 167, 95), title = 'Fill', group = VWAP_Ctl, inline = VWAP3_Settings)
// VWAP #4 Settings
VWAP4_Settings = 'VWAP #4 Settings'
VWAP4_Ctl = input(false, title = '', group = VWAP_Ctl, inline = VWAP4_Settings, display = display.data_window)
Anchor4 = input.string(defval = 'Day', title = '', group = VWAP_Ctl, inline = VWAP4_Settings, options = ['Day', 'Week', 'Month', 'Quarter', 'Year'])
VWAP4_Col = input.color(defval = color.rgb(255, 255, 255, 60), title = 'VWAP', group = VWAP_Ctl, inline = VWAP4_Settings)
Bands4_Col = input.color(defval = color.rgb(255, 255, 255, 60), title = 'Bands', group = VWAP_Ctl, inline = VWAP4_Settings)
VWAP4_Bgc = input.color(defval = color.rgb(255, 255, 255, 95), title = 'Fill', group = VWAP_Ctl, inline = VWAP4_Settings)
Multiplier = 'Multiplier For VWAP #2'
MultiplierX = 'MultiplierX'
MultiplierY = 'MultiplierY'
MultA_Ctl = input(true, title = '', group = Multiplier, inline = MultiplierX, display = display.data_window)
MultA_Val = input.float(1.5, step = 0.5, minval = 0, title = '', group = Multiplier, inline = MultiplierX, display = display.data_window)
MultA_Bgc = input.color(defval = color.rgb(91, 156, 246, 95), title = '', group = Multiplier, inline = MultiplierX)
MultB_Ctl = input(true, title = '', group = Multiplier, inline = MultiplierX, display = display.data_window)
MultB_Val = input.float(2.0, step = 0.5, minval = 0, title = '', group = Multiplier, inline = MultiplierX, display = display.data_window)
MultB_Bgc = input.color(defval = color.rgb(91, 156, 246, 100), title = '', group = Multiplier, inline = MultiplierX)
MultC_Ctl = input(true, title = '', group = Multiplier, inline = MultiplierY, display = display.data_window)
MultC_Val = input.float(2.5, step = 0.5, minval = 0, title = '', group = Multiplier, inline = MultiplierY, display = display.data_window)
MultC_Bgc = input.color(defval = color.rgb(91, 156, 246, 95), title = '', group = Multiplier, inline = MultiplierY)
MultD_Ctl = input(false, title = '', group = Multiplier, inline = MultiplierY, display = display.data_window)
MultD_Val = input.float(3.0, step = 0.5, minval = 0, title = '', group = Multiplier, inline = MultiplierY, display = display.data_window)
MultD_Bgc = input.color(defval = color.rgb(91, 156, 246, 95), title = '', group = Multiplier, inline = MultiplierY)
Src = hlc3
// Function to calculate new period
f_is_new_period(anchor) =>
switch anchor
'Day' => timeframe.change('D')
'Week' => timeframe.change('W')
'Month' => timeframe.change('M')
'Quarter' => timeframe.change('3M')
'Year' => timeframe.change('12M')
=> false
// Function to calculate VWAP and Bands
f_calculate_vwap(src, is_active, is_new_period, multa, multb, multc, multd, multa_ctl, multb_ctl, multc_ctl, multd_ctl) =>
var float vwap = na
var float band_upper = na
var float band_lower = na
var float multa_upper = na
var float multa_lower = na
var float multb_upper = na
var float multb_lower = na
var float multc_upper = na
var float multc_lower = na
var float multd_upper = na
var float multd_lower = na
if is_active and not timeframe.isdwm
[_vwap, _stdev_upper, _] = ta.vwap(src, is_new_period, 1)
stdev_abs = _stdev_upper - _vwap
vwap := _vwap
band_upper := vwap + stdev_abs
band_lower := vwap - stdev_abs
multa_upper := multa_ctl ? vwap + stdev_abs * multa : na
multa_lower := multa_ctl ? vwap - stdev_abs * multa : na
multb_upper := multb_ctl ? vwap + stdev_abs * multb : na
multb_lower := multb_ctl ? vwap - stdev_abs * multb : na
multc_upper := multc_ctl ? vwap + stdev_abs * multc : na
multc_lower := multc_ctl ? vwap - stdev_abs * multc : na
multd_upper := multd_ctl ? vwap + stdev_abs * multd : na
multd_lower := multd_ctl ? vwap - stdev_abs * multd : na
[vwap, band_upper, band_lower, multa_upper, multa_lower, multb_upper, multb_lower, multc_upper, multc_lower, multd_upper, multd_lower]
// VWAP Calculations
[vwap1, band1_upper, band1_lower, multa1_upper, multa1_lower, multb1_upper, multb1_lower, multc1_upper, multc1_lower, multd1_upper, multd1_lower] = f_calculate_vwap(Src, VWAP1_Ctl, f_is_new_period(Anchor1), MultA_Val, MultB_Val, MultC_Val, MultD_Val, MultA_Ctl, MultB_Ctl, MultC_Ctl, MultD_Ctl)
[vwap2, band2_upper, band2_lower, multa2_upper, multa2_lower, multb2_upper, multb2_lower, multc2_upper, multc2_lower, multd2_upper, multd2_lower] = f_calculate_vwap(Src, VWAP2_Ctl, f_is_new_period(Anchor2), MultA_Val, MultB_Val, MultC_Val, MultD_Val, MultA_Ctl, MultB_Ctl, MultC_Ctl, MultD_Ctl)
[vwap3, band3_upper, band3_lower, multa3_upper, multa3_lower, multb3_upper, multb3_lower, multc3_upper, multc3_lower, multd3_upper, multd3_lower] = f_calculate_vwap(Src, VWAP3_Ctl, f_is_new_period(Anchor3), MultA_Val, MultB_Val, MultC_Val, MultD_Val, MultA_Ctl, MultB_Ctl, MultC_Ctl, MultD_Ctl)
[vwap4, band4_upper, band4_lower, multa4_upper, multa4_lower, multb4_upper, multb4_lower, multc4_upper, multc4_lower, multd4_upper, multd4_lower] = f_calculate_vwap(Src, VWAP4_Ctl, f_is_new_period(Anchor4), MultA_Val, MultB_Val, MultC_Val, MultD_Val, MultA_Ctl, MultB_Ctl, MultC_Ctl, MultD_Ctl)
// Plot VWAP and Bands
vwap_plot1 = plot(VWAP1_Ctl ? vwap1 : na, color=VWAP1_Col)
lowerBand_1 = plot(VWAP1_Ctl ? band1_lower : na, color=Bands1_Col)
upperBand_1 = plot(VWAP1_Ctl ? band1_upper : na, color=Bands1_Col)
fill(upperBand_1, lowerBand_1, color=VWAP1_Bgc)
vwap_plot2 = plot(VWAP2_Ctl ? vwap2 : na, color=VWAP2_Col)
lowerBand_2 = plot(VWAP2_Ctl ? band2_lower : na, color=Bands2_Col)
upperBand_2 = plot(VWAP2_Ctl ? band2_upper : na, color=Bands2_Col)
fill(upperBand_2, lowerBand_2, color=VWAP2_Bgc)
vwap_plot3 = plot(VWAP3_Ctl ? vwap3 : na, color=VWAP3_Col)
lowerBand_3 = plot(VWAP3_Ctl ? band3_lower : na, color=Bands3_Col)
upperBand_3 = plot(VWAP3_Ctl ? band3_upper : na, color=Bands3_Col)
fill(upperBand_3, lowerBand_3, color=VWAP3_Bgc)
vwap_plot4 = plot(VWAP4_Ctl ? vwap4 : na, color=VWAP4_Col)
lowerBand_4 = plot(VWAP4_Ctl ? band4_lower : na, color=Bands4_Col)
upperBand_4 = plot(VWAP4_Ctl ? band4_upper : na, color=Bands4_Col)
fill(upperBand_4, lowerBand_4, color=VWAP4_Bgc)
// Plot MultA Bands and Fill
multa_lower_2_plot = plot(VWAP2_Ctl and MultA_Ctl ? multa2_lower : na, color=MultA_Bgc)
multa_upper_2_plot = plot(VWAP2_Ctl and MultA_Ctl ? multa2_upper : na, color=MultA_Bgc)
fill(upperBand_2, multa_upper_2_plot, color=MultA_Bgc)
fill(lowerBand_2, multa_lower_2_plot, color=MultA_Bgc)
// Plot MultB Bands and Fill
multb_lower_2_plot = plot(VWAP2_Ctl and MultB_Ctl ? multb2_lower : na, color=MultB_Bgc)
multb_upper_2_plot = plot(VWAP2_Ctl and MultB_Ctl ? multb2_upper : na, color=MultB_Bgc)
fill(multa_upper_2_plot, multb_upper_2_plot, color=MultB_Bgc)
fill(multa_lower_2_plot, multb_lower_2_plot, color=MultB_Bgc)
// Plot MultC Bands and Fill
multc_lower_2_plot = plot(VWAP2_Ctl and MultC_Ctl ? multc2_lower : na, color=MultC_Bgc)
multc_upper_2_plot = plot(VWAP2_Ctl and MultC_Ctl ? multc2_upper : na, color=MultC_Bgc)
fill(multb_upper_2_plot, multc_upper_2_plot, color=MultC_Bgc)
fill(multb_lower_2_plot, multc_lower_2_plot, color=MultC_Bgc)
// Plot MultD Bands and Fill
multd_lower_2_plot = plot(VWAP2_Ctl and MultD_Ctl ? multd2_lower : na, color=MultD_Bgc)
multd_upper_2_plot = plot(VWAP2_Ctl and MultD_Ctl ? multd2_upper : na, color=MultD_Bgc)
fill(multc_upper_2_plot, multd_upper_2_plot, color=MultD_Bgc)
fill(multc_lower_2_plot, multd_lower_2_plot, color=MultD_Bgc)
VWAP_Grp = 'VWAP Key Level'
currentDailyColor = input.color(title = '', defval = color.rgb(255, 255, 255, 20), group = VWAP_Grp, inline = 'daily1')
currentDaily = input.string(defval = 'Day', title = '', group = VWAP_Grp, inline = 'daily1', options = ['Day'])
var bool enablecurrentDailyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'daily1')
var bool enablecurrentDailyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'daily1')
var bool enablecurrentDailyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'daily1')
var float lastdailyLower = na
var float lastdailyUpper = na
var int lastdailyStart = na
var float lastdailyPOC = na
lastdailyColor = input.color(title = '', defval = color.rgb(255, 255, 255, 20), group = VWAP_Grp, inline = 'daily2')
lastdaily = input.string(defval = '↳', title = '', group = VWAP_Grp, inline = 'daily2', options = ['↳'])
var bool enablelastdailyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'daily2')
var bool enablelastdailyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'daily2')
var bool enablelastdailyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'daily2')
currentWeeklyColor = input.color(title = '', defval = color.rgb(133, 227, 167, 20), group = VWAP_Grp, inline = 'weekly3')
currentWeekly = input.string(defval = 'Week', title = '', group = VWAP_Grp, inline = 'weekly3', options = ['Week'])
var bool enablecurrentWeeklyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'weekly3')
var bool enablecurrentWeeklyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'weekly3')
var bool enablecurrentWeeklyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'weekly3')
var float lastWeeklyLower = na
var float lastWeeklyUpper = na
var int lastWeeklyStart = na
var float lastWeeklyPOC = na
lastWeeklyColor = input.color(title = '', defval = color.rgb(133, 227, 167, 20), group = VWAP_Grp, inline = 'weekly1')
lastWeekly = input.string(defval = '↳', title = '', group = VWAP_Grp, inline = 'weekly1', options = ['↳'])
var bool enablelastWeeklyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'weekly1')
var bool enablelastWeeklyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'weekly1')
var bool enablelastWeeklyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'weekly1')
var float lastlastWeeklyLower = na
var float lastlastWeeklyUpper = na
var int lastlastWeeklyStart = na
var float lastlastWeeklyPOC = na
lastlastWeeklyColor = input.color(title = '', defval = color.rgb(133, 227, 167, 20), group = VWAP_Grp, inline = 'weekly2')
lastlastWeekly = input.string(defval = '↳ ↳', title = '', group = VWAP_Grp, inline = 'weekly2', options = ['↳ ↳'])
var bool enablelastlastWeeklyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'weekly2')
var bool enablelastlastWeeklyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'weekly2')
var bool enablelastlastWeeklyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'weekly2')
currentMonthlyColor = input.color(title = '', defval = color.rgb(91, 156, 246, 20), group = VWAP_Grp, inline = 'monthly3')
currentMonthly = input.string(defval = 'Month', title = '', group = VWAP_Grp, inline = 'monthly3', options = ['Month'])
var bool enablecurrentMonthlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'monthly3')
var bool enablecurrentMonthlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'monthly3')
var bool enablecurrentMonthlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'monthly3')
var float lastMonthlyLower = na
var float lastMonthlyUpper = na
var int lastMonthlyStart = na
var float lastMonthlyPOC = na
lastMonthlyColor = input.color(title = '', defval = color.rgb(91, 156, 246, 20), group = VWAP_Grp, inline = 'monthly1')
lastMonthly = input.string(defval = '↳', title = '', group = VWAP_Grp, inline = 'monthly1', options = ['↳'])
var bool enablelastMonthlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'monthly1')
var bool enablelastMonthlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'monthly1')
var bool enablelastMonthlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'monthly1')
var float lastlastMonthlyLower = na
var float lastlastMonthlyUpper = na
var int lastlastMonthlyStart = na
var float lastlastMonthlyPOC = na
lastlastMonthlyColor = input.color(title = '', defval = color.rgb(91, 156, 246, 20), group = VWAP_Grp, inline = 'monthly2')
lastlastMonthly = input.string(defval = '↳ ↳', title = '', group = VWAP_Grp, inline = 'monthly2', options = ['↳ ↳'])
var bool enablelastlastMonthlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'monthly2')
var bool enablelastlastMonthlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'monthly2')
var bool enablelastlastMonthlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'monthly2')
currentQuarterlyColor = input.color(title = '', defval = color.rgb(255, 183, 77, 20), group = VWAP_Grp, inline = 'quarterly3')
currentQuarterly = input.string(defval = 'Quarter', title = '', group = VWAP_Grp, inline = 'quarterly3', options = ['Quarter'])
var bool enablecurrentQuarterlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'quarterly3')
var bool enablecurrentQuarterlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'quarterly3')
var bool enablecurrentQuarterlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'quarterly3')
var float lastQuarterlyLower = na
var float lastQuarterlyUpper = na
var int lastQuarterlyStart = na
var float lastQuarterlyPOC = na
lastQuarterlyColor = input.color(title = '', defval = color.rgb(255, 183, 77, 20), group = VWAP_Grp, inline = 'quarterly1')
lastQuarterly = input.string(defval = '↳', title = '', group = VWAP_Grp, inline = 'quarterly1', options = ['↳'])
var bool enablelastQuarterlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'quarterly1')
var bool enablelastQuarterlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'quarterly1')
var bool enablelastQuarterlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'quarterly1')
var float lastlastQuarterlyLower = na
var float lastlastQuarterlyUpper = na
var int lastlastQuarterlyStart = na
var float lastlastQuarterlyPOC = na
lastlastQuarterlyColor = input.color(title = '', defval = color.rgb(255, 183, 77, 20), group = VWAP_Grp, inline = 'quarterly2')
lastlastQuarterly = input.string(defval = '↳ ↳', title = '', group = VWAP_Grp, inline = 'quarterly2', options = ['↳ ↳'])
var bool enablelastlastQuarterlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'quarterly2')
var bool enablelastlastQuarterlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'quarterly2')
var bool enablelastlastQuarterlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'quarterly2')
currentyearlyColor = input.color(title = '', defval = color.rgb(240, 98, 146, 20), group = VWAP_Grp, inline = 'yearly3')
currentyearly = input.string(defval = 'Year', title = '', group = VWAP_Grp, inline = 'yearly3', options = ['Year'])
var bool enablecurrentyearlyLower = input.bool(false, title = 'Lower', group = VWAP_Grp, inline = 'yearly3')
var bool enablecurrentyearlyPOC = input.bool(false, title = 'VWAP', group = VWAP_Grp, inline = 'yearly3')
var bool enablecurrentyearlyUpper = input.bool(false, title = 'Upper', group = VWAP_Grp, inline = 'yearly3')
label_color_setting = color.new(#ecf008, 100)
right_bar = bar_index + Offset
format_level = '#.####'
var DEFAULT_LINE_STYLE = line.style_dotted
var DEFAULT_LABEL_STYLE = label.style_label_left
calcVWAP(src, isNewPeriod) =>
[_vwap, _stdevUpper, _] = ta.vwap(src, isNewPeriod, 1)
stdevAbs = _stdevUpper - _vwap
upperBand = _vwap + stdevAbs * 1.0
lowerBand = _vwap - stdevAbs * 1.0
[_vwap, upperBand, lowerBand]
[yearlyVWAP, yearlyUpper, yearlyLower] = calcVWAP(Src, timeframe.change('12M'))
[quarterlyVWAP, quarterlyUpper, quarterlyLower] = calcVWAP(Src, timeframe.change('3M'))
[monthlyVWAP, monthlyUpper, monthlyLower] = calcVWAP(Src, timeframe.change('M'))
[weeklyVWAP, weeklyUpper, weeklyLower] = calcVWAP(Src, timeframe.change('W'))
[dailyVWAP, dailyUpper, dailyLower] = calcVWAP(Src, timeframe.change('D'))
if timeframe.change('3M')
lastlastQuarterlyLower := lastQuarterlyLower
lastlastQuarterlyUpper := lastQuarterlyUpper
lastlastQuarterlyStart := lastQuarterlyStart
lastlastQuarterlyPOC := lastQuarterlyPOC
lastQuarterlyLower := quarterlyLower[1]
lastQuarterlyUpper := quarterlyUpper[1]
lastQuarterlyStart := bar_index[1]
lastQuarterlyPOC := quarterlyVWAP[1]
lastQuarterlyPOC
if timeframe.change('M')
lastlastMonthlyLower := lastMonthlyLower
lastlastMonthlyUpper := lastMonthlyUpper
lastlastMonthlyStart := lastMonthlyStart
lastlastMonthlyPOC := lastMonthlyPOC
lastMonthlyLower := monthlyLower[1]
lastMonthlyUpper := monthlyUpper[1]
lastMonthlyStart := bar_index[1]
lastMonthlyPOC := monthlyVWAP[1]
lastMonthlyPOC
if timeframe.change('W')
lastlastWeeklyLower := lastWeeklyLower
lastlastWeeklyUpper := lastWeeklyUpper
lastlastWeeklyStart := lastWeeklyStart
lastlastWeeklyPOC := lastWeeklyPOC
lastWeeklyLower := weeklyLower[1]
lastWeeklyUpper := weeklyUpper[1]
lastWeeklyStart := bar_index[1]
lastWeeklyPOC := weeklyVWAP[1]
lastWeeklyPOC
if timeframe.change('D')
lastdailyLower := dailyLower[1]
lastdailyUpper := dailyUpper[1]
lastdailyStart := bar_index[1]
lastdailyPOC := dailyVWAP[1]
lastdailyPOC
if barstate.islast
// Daily
if enablelastdailyLower
var lastdailyLowerline = line.new(x1 = lastdailyStart, y1 = lastdailyLower, x2 = right_bar, y2 = lastdailyLower, color = lastdailyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastdailyLowerlabel = label.new(x = right_bar, y = lastdailyLower, text = 'pdVWAP -1', tooltip = str.tostring(lastdailyLower, format_level), color = label_color_setting, textcolor = lastdailyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastdailyUpper
var lastdailyUpperline = line.new(x1 = lastdailyStart, y1 = lastdailyUpper, x2 = right_bar, y2 = lastdailyUpper, color = lastdailyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastdailyUpperlabel = label.new(x = right_bar, y = lastdailyUpper, text = 'pdVWAP +1', tooltip = str.tostring(lastdailyUpper, format_level), color = label_color_setting, textcolor = lastdailyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastdailyPOC
var lastdailyPOCline = line.new(x1 = lastdailyStart, y1 = lastdailyPOC, x2 = right_bar, y2 = lastdailyPOC, color = lastdailyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastdailyPOClabel = label.new(x = right_bar, y = lastdailyPOC, text = 'pdVWAP', tooltip = str.tostring(lastdailyPOC, format_level), color = label_color_setting, textcolor = lastdailyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentDailyLower
var lastdailyLowerline = line.new(x1 = lastdailyStart, y1 = dailyLower, x2 = right_bar, y2 = dailyLower, color = currentDailyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastdailyLowerlabel = label.new(x = right_bar, y = dailyLower, text = 'dVWAP -1', tooltip = str.tostring(dailyLower, format_level), color = label_color_setting, textcolor = currentDailyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentDailyUpper
var lastdailyUpperline = line.new(x1 = lastdailyStart, y1 = dailyUpper, x2 = right_bar, y2 = dailyUpper, color = currentDailyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastdailyUpperlabel = label.new(x = right_bar, y = dailyUpper, text = 'dVWAP +1', tooltip = str.tostring(dailyUpper, format_level), color = label_color_setting, textcolor = currentDailyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentDailyPOC
var lastdailyPOCline = line.new(x1 = lastdailyStart, y1 = dailyVWAP, x2 = right_bar, y2 = dailyVWAP, color = currentDailyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastdailyPOClabel = label.new(x = right_bar, y = dailyVWAP, text = 'dVWAP', tooltip = str.tostring(dailyVWAP, format_level), color = label_color_setting, textcolor = currentDailyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
// Weekly
if enablelastWeeklyLower
var lastWeeklyLowerline = line.new(x1 = lastdailyStart, y1 = lastWeeklyLower, x2 = right_bar, y2 = lastWeeklyLower, color = lastWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastWeeklyLowerlabel = label.new(right_bar, y = lastWeeklyLower, text = 'pwVWAP -1', tooltip = str.tostring(lastWeeklyLower, format_level), color = label_color_setting, textcolor = lastWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastWeeklyUpper
var lastWeeklyUpperline = line.new(x1 = lastdailyStart, y1 = lastWeeklyUpper, x2 = right_bar, y2 = lastWeeklyUpper, color = lastWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastWeeklyUpperlabel = label.new(x = right_bar, y = lastWeeklyUpper, text = 'pwVWAP +1', tooltip = str.tostring(lastWeeklyUpper, format_level), color = label_color_setting, textcolor = lastWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastWeeklyPOC
var lastWeeklyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastWeeklyPOC, y2 = lastWeeklyPOC, color = lastWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastWeeklyPOClabel = label.new(x = right_bar, y = lastWeeklyPOC, text = 'pwVWAP', tooltip = str.tostring(lastWeeklyPOC, format_level), color = label_color_setting, textcolor = lastWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastWeeklyLower
var lastlastWeeklyLowerline = line.new(x1 = lastdailyStart, y1 = lastlastWeeklyLower, x2 = right_bar, y2 = lastlastWeeklyLower, color = lastlastWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastWeeklyLowerlabel = label.new(x = right_bar, y = lastlastWeeklyLower, text = 'ppwVWAP -1', tooltip = str.tostring(lastlastWeeklyLower, format_level), color = label_color_setting, textcolor = lastlastWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastWeeklyUpper
var lastlastWeeklyUpperline = line.new(x1 = lastdailyStart, y1 = lastlastWeeklyUpper, x2 = right_bar, y2 = lastlastWeeklyUpper, color = lastlastWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastWeeklyUpperlabel = label.new(x = right_bar, y = lastlastWeeklyUpper, text = 'ppwVWAP +1', tooltip = str.tostring(lastlastWeeklyUpper, format_level), color = label_color_setting, textcolor = lastlastWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastWeeklyPOC
var lastlastWeeklyPOCline = line.new(x1 = lastdailyStart, y1 = lastlastWeeklyPOC, x2 = right_bar, y2 = lastlastWeeklyPOC, color = lastlastWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastWeeklyPOClabel = label.new(x = right_bar, y = lastlastWeeklyPOC, text = 'ppwVWAP', tooltip = str.tostring(lastlastWeeklyPOC, format_level), color = label_color_setting, textcolor = lastlastWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentWeeklyLower
var currentWeeklyLowerline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = weeklyLower, y2 = weeklyLower, color = currentWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentWeeklyLowerlabel = label.new(x = right_bar, y = weeklyLower, text = 'wVWAP -1', tooltip = str.tostring(weeklyLower, format_level), color = label_color_setting, textcolor = currentWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentWeeklyPOC
var currentWeeklyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = weeklyVWAP, y2 = weeklyVWAP, color = currentWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentWeeklyPOClabel = label.new(x = right_bar, y = weeklyVWAP, text = 'wVWAP', tooltip = str.tostring(weeklyVWAP, format_level), color = label_color_setting, textcolor = currentWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentWeeklyUpper
var currentWeeklyUpperline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = weeklyUpper, y2 = weeklyUpper, color = currentWeeklyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentWeeklyUpperlabel = label.new(x = right_bar, y = weeklyUpper, text = 'wVWAP +1', tooltip = str.tostring(weeklyUpper, format_level), color = label_color_setting, textcolor = currentWeeklyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
// Monthly
if enablelastMonthlyLower
var lastMonthlyLowerline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastMonthlyLower, y2 = lastMonthlyLower, color = lastMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastMonthlyLowerlabel = label.new(x = right_bar, y = lastMonthlyLower, text = 'pmVWAP -1', tooltip = str.tostring(lastMonthlyLower, format_level), color = label_color_setting, textcolor = lastMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastMonthlyUpper
var lastMonthlyUpperline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastMonthlyUpper, y2 = lastMonthlyUpper, color = lastMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastMonthlyUpperlabel = label.new(x = right_bar, y = lastMonthlyUpper, text = 'pmVWAP +1', tooltip = str.tostring(lastMonthlyUpper, format_level), color = label_color_setting, textcolor = lastMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastMonthlyPOC
var lastMonthlyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastMonthlyPOC, y2 = lastMonthlyPOC, color = lastMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastMonthlyPOClabel = label.new(x = right_bar, y = lastMonthlyPOC, text = 'pmVWAP', tooltip = str.tostring(lastMonthlyPOC, format_level), color = label_color_setting, textcolor = lastMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastMonthlyLower
var lastlastMonthlyLowerline = line.new(x1 = lastdailyStart, y1 = lastlastMonthlyLower, x2 = right_bar, y2 = lastlastMonthlyLower, color = lastlastMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastMonthlyLowerlabel = label.new(x = right_bar, y = lastlastMonthlyLower, text = 'ppmVWAP -1', tooltip = str.tostring(lastlastMonthlyLower, format_level), color = label_color_setting, textcolor = lastlastMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastMonthlyUpper
var lastlastMonthlyUpperline = line.new(x1 = lastdailyStart, y1 = lastlastMonthlyUpper, x2 = right_bar, y2 = lastlastMonthlyUpper, color = lastlastMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastMonthlyUpperlabel = label.new(x = right_bar, y = lastlastMonthlyUpper, text = 'ppmVWAP +1', tooltip = str.tostring(lastlastMonthlyUpper, format_level), color = label_color_setting, textcolor = lastlastMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastMonthlyPOC
var lastlastMonthlyPOCline = line.new(x1 = lastdailyStart, y1 = lastlastMonthlyPOC, x2 = right_bar, y2 = lastlastMonthlyPOC, color = lastlastMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastMonthlyPOClabel = label.new(x = right_bar, y = lastlastMonthlyPOC, text = 'ppmVWAP', tooltip = str.tostring(lastlastMonthlyPOC, format_level), color = label_color_setting, textcolor = lastlastMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentMonthlyLower
var currentMonthlyLowerline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = monthlyLower, y2 = monthlyLower, color = currentMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentMonthlyLowerlabel = label.new(x = right_bar, y = monthlyLower, text = 'mVWAP -1', tooltip = str.tostring(monthlyLower, format_level), color = label_color_setting, textcolor = currentMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentMonthlyPOC
var currentMonthlyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = monthlyVWAP, y2 = monthlyVWAP, color = currentMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentMonthlyPOClabel = label.new(x = right_bar, y = monthlyVWAP, text = 'mVWAP', tooltip = str.tostring(monthlyVWAP, format_level), color = label_color_setting, textcolor = currentMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentMonthlyUpper
var currentMonthlyUpperline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = monthlyUpper, y2 = monthlyUpper, color = currentMonthlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentMonthlyUpperlabel = label.new(x = right_bar, y = monthlyUpper, text = 'mVWAP +1', tooltip = str.tostring(monthlyUpper, format_level), color = label_color_setting, textcolor = currentMonthlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
// QUATERLY
if enablelastQuarterlyLower
var lastQuarterlyLowerline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastQuarterlyLower, y2 = lastQuarterlyLower, color = lastQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastQuarterlyLowerlabel = label.new(x = right_bar, y = lastQuarterlyLower, text = 'pqVWAP -1', tooltip = str.tostring(lastQuarterlyLower, format_level), color = label_color_setting, textcolor = lastQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastQuarterlyUpper
var lastQuarterlyUpperline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastQuarterlyUpper, y2 = lastQuarterlyUpper, color = lastQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastQuarterlyUpperlabel = label.new(x = right_bar, y = lastQuarterlyUpper, text = 'pqVWAP +1', tooltip = str.tostring(lastQuarterlyUpper, format_level), color = label_color_setting, textcolor = lastQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastQuarterlyPOC
var lastQuarterlyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastQuarterlyPOC, y2 = lastQuarterlyPOC, color = lastQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastQuarterlyPOClabel = label.new(x = right_bar, y = lastQuarterlyPOC, text = 'pqVWAP', tooltip = str.tostring(lastQuarterlyPOC, format_level), color = label_color_setting, textcolor = lastQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastQuarterlyLower
var lastlastQuarterlyLowerline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastlastQuarterlyLower, y2 = lastlastQuarterlyLower, color = lastlastQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastQuarterlyLowerlabel = label.new(x = right_bar, y = lastlastQuarterlyLower, text = 'ppqVWAP -1', tooltip = str.tostring(lastlastQuarterlyLower, format_level), color = label_color_setting, textcolor = lastlastQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastQuarterlyUpper
var lastlastQuarterlyUpperline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastlastQuarterlyUpper, y2 = lastlastQuarterlyUpper, color = lastlastQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastQuarterlyUpperlabel = label.new(x = right_bar, y = lastlastQuarterlyUpper, text = 'ppqVWAP +1', tooltip = str.tostring(lastlastQuarterlyUpper, format_level), color = label_color_setting, textcolor = lastlastQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablelastlastQuarterlyPOC
var lastlastQuarterlyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = lastlastQuarterlyPOC, y2 = lastlastQuarterlyPOC, color = lastlastQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var lastlastQuarterlyPOClabel = label.new(x = right_bar, y = lastlastQuarterlyPOC, text = 'ppqVWAP', tooltip = str.tostring(lastlastQuarterlyPOC, format_level), color = label_color_setting, textcolor = lastlastQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentQuarterlyLower
var currentQuarterlyLowerline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = quarterlyLower, y2 = quarterlyLower, color = currentQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentQuarterlyLowerlabel = label.new(x = right_bar, y = quarterlyLower, text = 'qVWAP -1', tooltip = str.tostring(quarterlyLower, format_level), color = label_color_setting, textcolor = currentQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentQuarterlyPOC
var currentQuarterlyPOCline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = quarterlyVWAP, y2 = quarterlyVWAP, color = currentQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentQuarterlyPOClabel = label.new(x = right_bar, y = quarterlyVWAP, text = 'qVWAP', tooltip = str.tostring(quarterlyVWAP, format_level), color = label_color_setting, textcolor = currentQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentQuarterlyUpper
var currentQuarterlyUpperline = line.new(x1 = lastdailyStart, x2 = right_bar, y1 = quarterlyUpper, y2 = quarterlyUpper, color = currentQuarterlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentQuarterlyUpperlabel = label.new(x = right_bar, y = quarterlyUpper, text = 'qVWAP +1', tooltip = str.tostring(quarterlyUpper, format_level), color = label_color_setting, textcolor = currentQuarterlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
// Yearly
if enablecurrentyearlyLower
var currentyearlyLowerline = line.new(x1 = lastdailyStart, y1 = yearlyLower, x2 = right_bar, y2 = yearlyLower, color = currentyearlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentyearlyLowerlabel = label.new(x = right_bar, y = yearlyLower, text = 'yVWAP -1', tooltip = str.tostring(yearlyLower, format_level), color = label_color_setting, textcolor = currentyearlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentyearlyPOC
var currentyearlyPOCline = line.new(x1 = lastdailyStart, y1 = yearlyVWAP, x2 = right_bar, y2 = yearlyVWAP, color = currentyearlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentyearlyPOClabel = label.new(x = right_bar, y = yearlyVWAP, text = 'yVWAP', tooltip = str.tostring(yearlyVWAP, format_level), color = label_color_setting, textcolor = currentyearlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)
if enablecurrentyearlyUpper
var currentyearlyUpperline = line.new(x1 = lastdailyStart, y1 = yearlyUpper, x2 = right_bar, y2 = yearlyUpper, color = currentyearlyColor, width = 1, style = DEFAULT_LINE_STYLE)
var currentyearlyUpperlabel = label.new(x = right_bar, y = yearlyUpper, text = 'yVWAP +1', tooltip = str.tostring(yearlyUpper, format_level), color = label_color_setting, textcolor = currentyearlyColor, style = DEFAULT_LABEL_STYLE, xloc = xloc.bar_index, text_font_family = font.family_monospace)