Volumatic Vidya
Volumatic Vidya
//@version=6
indicator('Volumatic Variable Index Dynamic Average [BigBeluga]', 'Volumatic VIDYA
[BigBeluga]', overlay = true, max_lines_count = 500, max_labels_count = 500)
// INPUTS
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――{
// Input parameters for length, momentum, and source data
int vidya_length = input.int(10, 'VIDYA Length') // Length of the VIDYA calculation
int vidya_momentum = input.int(20, 'VIDYA Momentum') // Momentum length for VIDYA
float band_distance = input.float(2, 'Distance factor for upper/lower bands', step
= 0.1) // Distance factor for upper/lower bands
// Define pivot parameters
int pivot_left_bars = 3 // Left side pivot bars
int pivot_right_bars = pivot_left_bars // Right side pivot bars
// FUNCTION
S――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
―――――――――――――――――――――――――――{
ta.sma(vidya_value, 15)
// CALCULATION
S――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――{
// Calculate the Average True Range (ATR)
float atr_value = ta.atr(200) // ATR calculation with length of 200
liquidity_lines_low.push(pivot_line)
volume_value := math.sum(volume, pivot_right_bars + pivot_left_bars) /
(pivot_right_bars + pivot_left_bars)
volume_value
liquidity_lines_high.push(pivot_line)
volume_value := math.sum(-volume, pivot_right_bars + pivot_left_bars) /
(pivot_right_bars + pivot_left_bars)
volume_value
// }
// PLOT
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
――――――――――――――――――――――――――{
// Display labels for volume and trend statistics on the last bar
if barstate.islast
label.delete(label.new(bar_index, smoothed_value, 'Buy: ' +
str.tostring(up_trend_volume, format.volume) + '\n Sell: ' +
str.tostring(down_trend_volume, format.volume) + '\nDelta Volume: ' + delta_volume,
color = color.new(trend_color, 90), style = is_trend_up ?
label.style_label_upper_left : label.style_label_lower_left, textcolor =
chart.fg_color)[1])