0% found this document useful (0 votes)
14 views2 pages

Gamma G3

this tradingview indicator showing liqudaty levels

Uploaded by

azeemali25693
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Gamma G3

this tradingview indicator showing liqudaty levels

Uploaded by

azeemali25693
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

// This Indicator Created By Muhammad Azeem

//@version=5
indicator("GAMMA G3", overlay=true)

// === Parameters ===


pivot_length = input.int(5, "Pivot Length", minval=1, maxval=100, tooltip="Number
of bars to the left and right of the pivot")
high_line_color = input.color(#000000, "High Line Color", tooltip="Color of the
high pivot lines")
low_line_color = input.color(#000000, "Low Line Color", tooltip="Color of the low
pivot lines")
high_line_width = input.int(1, "High Line Width", minval=1, maxval=5,
tooltip="Width of the high pivot lines")
low_line_width = input.int(1, "Low Line Width", minval=1, maxval=5, tooltip="Width
of the low pivot lines")
extend_bars = input.int(500, "Extend Bars to Right", minval=1, tooltip="Number of
bars to extend lines to the right")

// === Detect Pivot Highs and Lows ===


ph = ta.pivothigh(high, pivot_length, pivot_length)
pl = ta.pivotlow(low, pivot_length, pivot_length)

// === Variables to Store Unbroken Pivots and Lines ===


var line[] pivot_high_lines = array.new_line(0)
var line[] pivot_low_lines = array.new_line(0)
var float[] unbroken_pivot_highs = array.new_float(0)
var float[] unbroken_pivot_lows = array.new_float(0)

// === Draw/Extend and Remove Lines for Pivot Highs ===


if not na(ph)
// New pivot high detected
unbroken_pivot_high = high[pivot_length]
pivot_high_line = line.new(bar_index - pivot_length, unbroken_pivot_high,
bar_index + extend_bars, unbroken_pivot_high, color=high_line_color,
width=high_line_width, style=line.style_solid)
array.push(pivot_high_lines, pivot_high_line)
array.push(unbroken_pivot_highs, unbroken_pivot_high)

// Iterate through high lines and remove if broken


if array.size(pivot_high_lines) > 0
for i = array.size(pivot_high_lines) - 1 to 0
line current_line = array.get(pivot_high_lines, i)
float current_level = array.get(unbroken_pivot_highs, i)
if high >= current_level or close >= current_level
line.delete(current_line)
array.remove(pivot_high_lines, i)
array.remove(unbroken_pivot_highs, i)
else
// Extend line by specified bars to the right
line.set_x2(current_line, bar_index + extend_bars)

// === Draw/Extend and Remove Lines for Pivot Lows ===


if not na(pl)
// New pivot low detected
unbroken_pivot_low = low[pivot_length]
pivot_low_line = line.new(bar_index - pivot_length, unbroken_pivot_low,
bar_index + extend_bars, unbroken_pivot_low, color=low_line_color,
width=low_line_width, style=line.style_solid)
array.push(pivot_low_lines, pivot_low_line)
array.push(unbroken_pivot_lows, unbroken_pivot_low)

// Iterate through low lines and remove if broken


if array.size(pivot_low_lines) > 0
for i = array.size(pivot_low_lines) - 1 to 0
line current_line = array.get(pivot_low_lines, i)
float current_level = array.get(unbroken_pivot_lows, i)
if low <= current_level or close <= current_level
line.delete(current_line)
array.remove(pivot_low_lines, i)
array.remove(unbroken_pivot_lows, i)
else
// Extend line by specified bars to the right
line.set_x2(current_line, bar_index + extend_bars)

You might also like