This elliott wave Trading View Indicator to PRO real time please
Forums › ProRealTime English forum › ProBuilder support › This elliott wave Trading View Indicator to PRO real time please
- This topic has 9 replies, 4 voices, and was last updated 4 months ago by GraHal.
-
-
05/31/2024 at 9:47 AM #233323
hi Ivan
Can you please convert this indicator to pro real time please i think this will benefit lot of people too
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo//@version=5
indicator(“Elliott Wave [LuxAlgo]”, max_lines_count=500, max_labels_count=500, overlay=true, max_bars_back=5000)
//——————————————————————————
//Settings
//—————————————————————————–{
i_hi = input.string(‘high’ , title= ” , group=’source [high – low]’, inline=’hl’, options=[‘high’, ‘close’, ‘max open/close’])
i_lo = input.string(‘low’ , title= ” , group=’source [high – low]’, inline=’hl’, options=[‘low’ , ‘close’, ‘min open/close’])s1 = input.bool (true , title= ” , group=’ZigZag’ , inline= ‘1’ )
len1 = input.int ( 4 , title= ‘ 1 Length’, group=’ZigZag’ , inline= ‘1’, minval =1 )
col1 = input.color (color.red , title= ” , group=’ZigZag’ , inline= ‘1’ )
s2 = input.bool (true , title= ” , group=’ZigZag’ , inline= ‘2’ )
len2 = input.int ( 8 , title= ‘ 2 Length’, group=’ZigZag’ , inline= ‘2’, minval =1 )
col2 = input.color (color.blue , title= ” , group=’ZigZag’ , inline= ‘2’ )
s3 = input.bool (true , title= ” , group=’ZigZag’ , inline= ‘3’ )
len3 = input.int (16 , title= ‘ 3 Length’, group=’ZigZag’ , inline= ‘3’, minval =1 )
col3 = input.color (color.white , title= ” , group=’ZigZag’ , inline= ‘3’ )i_500 = input.float (0.500 , title=’ level 1′, group=’Fibonacci values’ , minval =0, maxval =1, step =0.01 )
i_618 = input.float (0.618 , title=’ level 2′, group=’Fibonacci values’ , minval =0, maxval =1, step =0.01 )
i_764 = input.float (0.764 , title=’ level 3′, group=’Fibonacci values’ , minval =0, maxval =1, step =0.01 )
i_854 = input.float (0.854 , title=’ level 4′, group=’Fibonacci values’ , minval =0, maxval =1, step =0.01 )shZZ = input.bool (false , title= ” , group=’show ZZ’ , inline=’zz’ )
//—————————————————————————–}
//User Defined Types
//—————————————————————————–{
type ZZ
int [] d
int [] x
float[] y
line [] ltype Ewave
line l1
line l2
line l3
line l4
line l5
label b1
label b2
label b3
label b4
label b5
//
bool on
bool br //= na
//
int dir
//
line lA
line lB
line lC
label bA
label bB
label bC
//
bool next = false
//
label lb
box bxtype fibL
line wave1_0_500
line wave1_0_618
line wave1_0_764
line wave1_0_854
line wave1_pole_
linefill l_fill_
bool _break_ //= na//—————————————————————————–}
//Functions
//—————————————————————————–{
hi = i_hi == ‘high’ ? high : i_hi == ‘close’ ? close : math.max(open, close)
lo = i_lo == ‘low’ ? low : i_hi == ‘close’ ? close : math.min(open, close)in_out(aZZ, d, x1, y1, x2, y2, col) =>
aZZ.d.unshift(d), aZZ.x.unshift(x2), aZZ.y.unshift(y2), aZZ.d.pop(), aZZ.x.pop(), aZZ.y.pop()
if shZZ
aZZ.l.unshift(line.new(x1, y1, x2, y2, color= col)), aZZ.l.pop().delete()method isSame(Ewave gEW, _1x, _2x, _3x, _4x) =>
t1 = _1x == gEW.l1.get_x1()
t2 = _2x == gEW.l2.get_x1()
t3 = _3x == gEW.l3.get_x1()
t4 = _4x == gEW.l4.get_x1()
t1 and t2 and t3 and t4method isSame2(Ewave gEW, _1x, _2x, _3x) =>
t1 = _1x == gEW.l3.get_x2()
t2 = _2x == gEW.l4.get_x2()
t3 = _3x == gEW.l5.get_x2()
t1 and t2 and t3method dot(Ewave gEW) =>
gEW.l1.set_style(line.style_dotted)
gEW.l2.set_style(line.style_dotted)
gEW.l3.set_style(line.style_dotted)
gEW.l4.set_style(line.style_dotted)
gEW.l5.set_style(line.style_dotted)
gEW.b1.set_textcolor (color(na))
gEW.b2.set_textcolor (color(na))
gEW.b3.set_textcolor (color(na))
gEW.b4.set_textcolor (color(na))
gEW.b5.set_textcolor (color(na))
gEW.on := falsemethod dash(Ewave gEW) =>
gEW.lA.set_style(line.style_dashed)
gEW.lB.set_style(line.style_dashed)
gEW.lC.set_style(line.style_dashed)
gEW.bA.set_textcolor (color(na))
gEW.bB.set_textcolor (color(na))
gEW.bC.set_textcolor (color(na))
gEW.bx.set_bgcolor (color(na))
gEW.bx.set_border_color (color(na))method sol_dot(fibL nFibL, sol_dot, col) =>
style =
sol_dot == ‘dot’ ?
line.style_dotted :
sol_dot == ‘sol’ ?
line.style_solid :
line.style_dashed
nFibL.wave1_0_500.set_style(style)
nFibL.wave1_0_618.set_style(style)
nFibL.wave1_0_764.set_style(style)
nFibL.wave1_0_854.set_style(style)
nFibL.l_fill_.set_color(col)method set(fibL nFibL, int x1, int x2, float max_500, float max_618, float max_764, float max_854, float y2) =>
nFibL.wave1_0_500.set_xy1(x1, max_500)
nFibL.wave1_0_500.set_xy2(x2, max_500)
nFibL.wave1_0_618.set_xy1(x1, max_618)
nFibL.wave1_0_618.set_xy2(x2, max_618)
nFibL.wave1_0_764.set_xy1(x1, max_764)
nFibL.wave1_0_764.set_xy2(x2, max_764)
nFibL.wave1_0_854.set_xy1(x1, max_854)
nFibL.wave1_0_854.set_xy2(x2, max_854)
nFibL.wave1_pole_.set_xy1(x1, y2 )
nFibL.wave1_pole_.set_xy2(x1, max_854)
nFibL.l_fill_.get_line1().set_xy1(x1, max_764)
nFibL.l_fill_.get_line1().set_xy2(x2, max_764)
nFibL.l_fill_.get_line2().set_xy1(x1, max_854)
nFibL.l_fill_.get_line2().set_xy2(x2, max_854)method setNa(fibL nFibL) =>
nFibL.wave1_0_500.set_xy1(na, na)
nFibL.wave1_0_500.set_xy2(na, na)
nFibL.wave1_0_618.set_xy1(na, na)
nFibL.wave1_0_618.set_xy2(na, na)
nFibL.wave1_0_764.set_xy1(na, na)
nFibL.wave1_0_764.set_xy2(na, na)
nFibL.wave1_0_854.set_xy1(na, na)
nFibL.wave1_0_854.set_xy2(na, na)
nFibL.wave1_pole_.set_xy1(na, na)
nFibL.wave1_pole_.set_xy2(na, na)
nFibL.l_fill_.set_color(color(na))draw(enabled, left, col, n) =>
//
max_bars_back(time, 2000)
var int dir = na, var int x1= na, var float y1 = na, var int x2 = na, var float y2 = na, var Ewave gEW = na
var int last_0x = na , var float last_0y = na , var int last_6x = na , var float last_6y = na
//
if enabled
var fibL nFibL = fibL.new(
wave1_0_500 = line.new(na, na, na, na, color= color.new(col, 50), style= line.style_solid ),
wave1_0_618 = line.new(na, na, na, na, color= color.new(col, 38), style= line.style_solid ),
wave1_0_764 = line.new(na, na, na, na, color= color.new(col, 24), style= line.style_solid ),
wave1_0_854 = line.new(na, na, na, na, color= color.new(col, 15), style= line.style_solid ),
wave1_pole_ = line.new(na, na, na, na, color= color.new(col, 50), style= line.style_dashed),
l_fill_ = linefill.new(
line.new(na, na, na, na, color= color(na))
, line.new(na, na, na, na, color= color(na))
, color= color(na))
, _break_ = na
)
//
var ZZ aZZ = ZZ.new(array.new < int > ()
, array.new < int > ()
, array.new < float > ()
, array.new < line > () )
var Ewave[] aEW = array.new < Ewave > ()
//
if barstate.isfirst
aEW.unshift(Ewave.new())
for i = 0 to 10
aZZ.d.unshift(0)
aZZ.x.unshift(0)
aZZ.y.unshift(0)
aZZ.l.unshift(shZZ ? line.new(na, na, na, na) : na)
//
sz = aZZ.d.size( )
x2 := bar_index -1
ph = ta.pivothigh(hi, left, 1)
pl = ta.pivotlow (lo, left, 1)
t = n == 2 ? ‘\n\n’ : n == 1 ? ‘\n’ : ”
//
// when a new Pivot High is found
if not na(ph)
gEW := aEW.get (0)
dir := aZZ.d.get (0)
x1 := aZZ.x.get (0)
y1 := aZZ.y.get (0)
y2 := nz(hi[1])
//
if dir < 1 // if previous point was a pl, add, and change direction ( 1)
in_out(aZZ, 1, x1, y1, x2, y2, col)
else
if dir == 1 and ph > y1
aZZ.x.set(0, x2), aZZ.y.set(0, y2)
if shZZ
aZZ.l.get(0).set_xy2(x2, y2)
//
_6x = x2, _6y = y2
_5x = aZZ.x.get(1), _5y = aZZ.y.get(1)
_4x = aZZ.x.get(2), _4y = aZZ.y.get(2)
_3x = aZZ.x.get(3), _3y = aZZ.y.get(3)
_2x = aZZ.x.get(4), _2y = aZZ.y.get(4)
_1x = aZZ.x.get(5), _1y = aZZ.y.get(5)
//
// –––––––––––––––––––––[ 12345 ]–––––––––––––––––––––
_W5 = _6y – _5y
_W3 = _4y – _3y
_W1 = _2y – _1y
min = math.min(_W1, _W3, _W5)
isWave =
_W3 != min and
_6y > _4y and
_3y > _1y and
_5y > _2y
//
same = gEW.isSame(_1x, _2x, _3x, _4x)
if isWave
if same
gEW.l5.set_xy2(_6x, _6y)
gEW.b5.set_xy (_6x, _6y)
else
tx = ”
if _2x == aEW.get(0).b5.get_x()
tx := ‘(5) (1)’
aEW.get(0).b5.set_text(”)
else
tx := ‘(1)’
//
wave = Ewave.new(
l1 = line.new (_1x, _1y, _2x, _2y , color=col , style= line.style_solid ),
l2 = line.new (_2x, _2y, _3x, _3y , color=col , style= line.style_solid ),
l3 = line.new (_3x, _3y, _4x, _4y , color=col , style= line.style_solid ),
l4 = line.new (_4x, _4y, _5x, _5y , color=col , style= line.style_solid ),
l5 = line.new (_5x, _5y, _6x, _6y , color=col , style= line.style_solid ),
b1 = label.new(_2x, _2y, text= tx + t, textcolor=col, color= color(na), style=label.style_label_down),
b2 = label.new(_3x, _3y, text= t + ‘(2)’, textcolor=col, color= color(na), style=label.style_label_up ),
b3 = label.new(_4x, _4y, text= ‘(3)’ + t, textcolor=col, color= color(na), style=label.style_label_down),
b4 = label.new(_5x, _5y, text= t + ‘(4)’, textcolor=col, color= color(na), style=label.style_label_up ),
b5 = label.new(_6x, _6y, text= ‘(5)’ + t, textcolor=col, color= color(na), style=label.style_label_down),
on = true ,
br = false ,
dir = 1
)
aEW.unshift(wave)
nFibL._break_ := false
alert(‘New EW Motive Bullish Pattern found’ , alert.freq_once_per_bar_close)
//
if not isWave
if same and gEW.on == true
gEW.dot()
alert(‘Invalidated EW Motive Bullish Pattern’, alert.freq_once_per_bar_close)
//
// –––––––––––––––––––––[ ABC ]–––––––––––––––––––––
getEW = aEW.get(0)
last_0x := getEW.l1.get_x1(), last_0y := getEW.l1.get_y1()
last_6x := getEW.l5.get_x2(), last_6y := getEW.l5.get_y2()
diff = math.abs(last_6y – last_0y)
//
if getEW.dir == -1
getX = getEW.l5.get_x2()
getY = getEW.l5.get_y2()
isSame2 = getEW.isSame2 (_1x, _2x, _3x)
isValid =
_3x == getX and
_6y < getY + (diff * i_854) and
_4y < getY + (diff * i_854) and
_5y > getY
//
if isValid
width = _6x – _2x // –––[ width (4) – (c) ]–––
if isSame2 and getEW.bA.get_x() > _3x
getEW.lC.set_xy1(_5x, _5y), getEW.lC.set_xy2(_6x, _6y), getEW.bC.set_xy(_6x, _6y), getEW.bx.set_lefttop(_6x, _6y), getEW.bx.set_right(_6x + width)
else
getEW.lA := line.new (_3x, _3y, _4x, _4y, color=col), getEW.bA := label.new(_4x, _4y, text= ‘(a)’ + t, textcolor=col, color= color(na), style=label.style_label_down)
getEW.lB := line.new (_4x, _4y, _5x, _5y, color=col), getEW.bB := label.new(_5x, _5y, text= t + ‘(b)’, textcolor=col, color= color(na), style=label.style_label_up )
getEW.lC := line.new (_5x, _5y, _6x, _6y, color=col), getEW.bC := label.new(_6x, _6y, text= ‘(c)’ + t, textcolor=col, color= color(na), style=label.style_label_down)
getEW.bx := box.new (_6x, _6y, _6x + width, _4y, bgcolor=color.new(col, 93), border_color=color.new(col, 65))
alert(‘New EW Corrective Bullish Pattern found’ , alert.freq_once_per_bar_close)
else
if isSame2 and getEW.bA.get_x() > _3x
getEW.dash()
alert(‘Invalidated EW Corrective Bullish Pattern’, alert.freq_once_per_bar_close)
//
// –––––––––––––––––––––[ new (1) ? ]–––––––––––––––––––––
if getEW.dir == 1
if _5x == getEW.bC.get_x() and
_6y > getEW.b5.get_y() and
getEW.next == false
getEW.next := true
getEW.lb := label.new(_6x, _6y, style=label.style_circle, color=color.new(col, 65), yloc=yloc.abovebar, size=size.tiny)
alert(‘Possible new start of EW Motive Bullish Wave’, alert.freq_once_per_bar_close)
//
// when a new Pivot Low is found
if not na(pl)
gEW := aEW.get (0)
dir := aZZ.d.get (0)
x1 := aZZ.x.get (0)
y1 := aZZ.y.get (0)
y2 := nz(lo[1])
//
if dir > -1 // if previous point was a ph, add, and change direction (-1)
in_out(aZZ, -1, x1, y1, x2, y2, col)
else
if dir == -1 and pl < y1
aZZ.x.set(0, x2), aZZ.y.set(0, y2)
if shZZ
aZZ.l.get(0).set_xy2(x2, y2)
//
_6x = x2, _6y = y2
_5x = aZZ.x.get(1), _5y = aZZ.y.get(1)
_4x = aZZ.x.get(2), _4y = aZZ.y.get(2)
_3x = aZZ.x.get(3), _3y = aZZ.y.get(3)
_2x = aZZ.x.get(4), _2y = aZZ.y.get(4)
_1x = aZZ.x.get(5), _1y = aZZ.y.get(5)
//
// –––––––––––––––––––––[ 12345 ]–––––––––––––––––––––
_W5 = _5y – _6y
_W3 = _3y – _4y
_W1 = _1y – _2y
min = math.min(_W1, _W3, _W5)
isWave =
_W3 != min and
_4y > _6y and
_1y > _3y and
_2y > _5y
//
same = isSame(gEW, _1x, _2x, _3x, _4x)
if isWave
if same
gEW.l5.set_xy2(_6x, _6y)
gEW.b5.set_xy (_6x, _6y)
else
tx = ”
if _2x == aEW.get(0).b5.get_x()
tx := ‘(5) (1)’
aEW.get(0).b5.set_text(”)
else
tx := ‘(1)’
//
wave = Ewave.new(
l1 = line.new (_1x, _1y, _2x, _2y , color=col , style= line.style_solid ),
l2 = line.new (_2x, _2y, _3x, _3y , color=col , style= line.style_solid ),
l3 = line.new (_3x, _3y, _4x, _4y , color=col , style= line.style_solid ),
l4 = line.new (_4x, _4y, _5x, _5y , color=col , style= line.style_solid ),
l5 = line.new (_5x, _5y, _6x, _6y , color=col , style= line.style_solid ),
b1 = label.new(_2x, _2y, text= t + tx, textcolor=col, color= color(na), style=label.style_label_up ),
b2 = label.new(_3x, _3y, text= ‘(2)’ + t, textcolor=col, color= color(na), style=label.style_label_down),
b3 = label.new(_4x, _4y, text= t + ‘(3)’, textcolor=col, color= color(na), style=label.style_label_up ),
b4 = label.new(_5x, _5y, text= ‘(4)’ + t, textcolor=col, color= color(na), style=label.style_label_down),
b5 = label.new(_6x, _6y, text= t + ‘(5)’, textcolor=col, color= color(na), style=label.style_label_up ),
on = true ,
br = false ,
dir =-1
)
aEW.unshift(wave)
nFibL._break_ := false
alert(‘New EW Motive Bearish Pattern found’ , alert.freq_once_per_bar_close)
//
if not isWave
if same and gEW.on == true
gEW.dot()
alert(‘Invalidated EW Motive Bearish Pattern’, alert.freq_once_per_bar_close)
//
// –––––––––––––––––––––[ ABC ]–––––––––––––––––––––
getEW = aEW.get(0)
last_0x := getEW.l1.get_x1(), last_0y := getEW.l1.get_y1()
last_6x := getEW.l5.get_x2(), last_6y := getEW.l5.get_y2()
diff = math.abs(last_6y – last_0y)
//
if getEW.dir == 1
getX = getEW.l5.get_x2()
getY = getEW.l5.get_y2()
isSame2 = getEW.isSame2 (_1x, _2x, _3x)
isValid =
_3x == getX and
_6y > getY – (diff * i_854) and
_4y > getY – (diff * i_854) and
_5y < getY
//
if isValid
width = _6x – _2x // –––[ width (4) – (c) ]–––
if isSame2 and getEW.bA.get_x() > _3x
getEW.lC.set_xy1(_5x, _5y), getEW.lC.set_xy2(_6x, _6y), getEW.bC.set_xy(_6x, _6y), getEW.bx.set_lefttop(_6x, _6y), getEW.bx.set_right(_6x + width)
else
getEW.lA := line.new (_3x, _3y, _4x, _4y, color=col), getEW.bA := label.new(_4x, _4y, text= t + ‘(a)’, textcolor=col, color= color(na), style=label.style_label_up )
getEW.lB := line.new (_4x, _4y, _5x, _5y, color=col), getEW.bB := label.new(_5x, _5y, text= ‘(b)’ + t, textcolor=col, color= color(na), style=label.style_label_down)
getEW.lC := line.new (_5x, _5y, _6x, _6y, color=col), getEW.bC := label.new(_6x, _6y, text= t + ‘(c)’, textcolor=col, color= color(na), style=label.style_label_up )
getEW.bx := box.new (_6x, _6y, _6x + width, _4y, bgcolor=color.new(col, 93), border_color=color.new(col, 65))
alert(‘New EW Corrective Bearish Pattern found’ , alert.freq_once_per_bar_close)
else
if isSame2 and getEW.bA.get_x() > _3x
getEW.dash()
alert(‘Invalidated EW Corrective Bullish Pattern’, alert.freq_once_per_bar_close)
//
// –––[ check (only once) for a possible new (1) after an impulsive AND corrective wave ]–––
if getEW.dir == -1
if _5x == getEW.bC.get_x() and
_6y < getEW.b5.get_y() and
getEW.next == false
getEW.next := true
getEW.lb := label.new(_6x, _6y, style=label.style_circle, color=color.new(col, 65), yloc=yloc.belowbar, size=size.tiny)
alert(‘Possible new start of EW Motive Bearish Wave’, alert.freq_once_per_bar_close)
//
// –––[ check for break box ]–––
if aEW.size() > 0
gEW := aEW.get(0)
if gEW.dir == 1
if ta.crossunder(low , gEW.bx.get_bottom()) and bar_index <= gEW.bx.get_right()
label.new(bar_index, low , yloc= yloc.belowbar, style= label.style_xcross, color=color.red, size=size.tiny)
else
if ta.crossover (high, gEW.bx.get_top ()) and bar_index <= gEW.bx.get_right()
label.new(bar_index, high, yloc= yloc.abovebar, style= label.style_xcross, color=color.red, size=size.tiny)
//
if barstate.islast
// –––[ get last 2 EW’s ]–––
getEW = aEW.get(0)
if aEW.size() > 1
getEW1 = aEW.get(1)
last_0x := getEW.l1.get_x1(), last_0y := getEW.l1.get_y1()
last_6x := getEW.l5.get_x2(), last_6y := getEW.l5.get_y2()
//
diff = math.abs(last_6y – last_0y) // –––[ max/min difference ]–––
_500 = diff * i_500
_618 = diff * i_618
_764 = diff * i_764
_854 = diff * i_854
bull = getEW.dir == 1
// –––[ if EW is not valid or an ABC has developed -> remove fibonacci lines ]–––
if getEW.on == false or getEW.bC.get_x() > getEW.b5.get_x()
nFibL.setNa()
else
// –––[ get.on == true ~ valid EW ]–––
max_500 = last_6y + ((bull ? -1 : 1) * _500)
max_618 = last_6y + ((bull ? -1 : 1) * _618)
max_764 = last_6y + ((bull ? -1 : 1) * _764)
max_854 = last_6y + ((bull ? -1 : 1) * _854)
//
nFibL.set(last_6x, bar_index + 10, max_500, max_618, max_764, max_854, last_6y)
// –––[ if (2) label overlap with (C) label ]–––
if getEW.b2.get_x() == getEW1.bC.get_x()
getEW.b1.set_textcolor(color(na))
getEW.b2.set_textcolor(color(na))
strB = getEW1.bB.get_text()
strC = getEW1.bC.get_text()
strB_ = str.replace(strB, “(b)”, “(b) (1)”, 0)
strC_ = str.replace(strC, “(c)”, “(c) (2)”, 0)
getEW1.bB.set_text(strB_)
getEW1.bC.set_text(strC_)
//
// –––[ check if fib limits are broken ]–––
getP_854 = nFibL.wave1_0_854.get_y1()
for i = 0 to bar_index – nFibL.wave1_0_854.get_x1()
if getEW.dir == -1
if high[i] > getP_854
nFibL._break_ := true
break
else
if low [i] < getP_854
nFibL._break_ := true
break
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
switch nFibL._break_
true => nFibL.sol_dot(‘dot’, color.new(color.red , 95))
false => nFibL.sol_dot(‘sol’, color.new(color.lime, 95))
=>
nFibL.wave1_0_500.set_xy1(na, na)
nFibL.wave1_0_500.set_xy2(na, na)
nFibL.wave1_0_618.set_xy1(na, na)
nFibL.wave1_0_618.set_xy2(na, na)
nFibL.wave1_0_764.set_xy1(na, na)
nFibL.wave1_0_764.set_xy2(na, na)
nFibL.wave1_0_854.set_xy1(na, na)
nFibL.wave1_0_854.set_xy2(na, na)
nFibL.wave1_pole_.set_xy1(na, na)
nFibL.wave1_pole_.set_xy2(na, na)
nFibL.l_fill_.set_color(color(na))if aEW.size() > 15
pop = aEW.pop()
pop.l1.delete(), pop.b1.delete()
pop.l2.delete(), pop.b2.delete()
pop.l3.delete(), pop.b3.delete()
pop.l4.delete(), pop.b4.delete()
pop.l5.delete(), pop.b5.delete()
pop.lA.delete(), pop.bA.delete()
pop.lB.delete(), pop.bB.delete()
pop.lC.delete(), pop.bC.delete()
pop.lb.delete(), pop.bx.delete()
//———————————-//—————————————————————————–}
//Plots
//—————————————————————————–{
draw(s1, len1, col1, 0)
draw(s2, len2, col2, 1)
draw(s3, len3, col3, 2)//—————————————————————————–}
06/05/2024 at 6:49 AM #23350506/05/2024 at 8:06 AM #23350806/05/2024 at 8:55 AM #23351707/17/2024 at 12:19 PM #235381Hi,
Here you have the code. Is not the translation because it needs functions not yet available.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193//-------------------------------------------------------------------------------////PRC_Elliot Wave ZigZag//version = 0//17.07.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-------------------------------------------------------------------------------//defparam drawonlastbaronly=true//-----Inputs--------------------------------------------------------------------//perc=1//-------------------------------------------------------------------------------//$newhigh[0]=0//-------------------------------------------------------------------------------//zz=ZigZag[perc](close)//---Pivot high------------------------------------------------------------------//if zz<zz[1] and zz[1]>zz[2] then$pivoty[n+1]=close[1]$pivotx[n+1]=barindex[1]$newhigh[n+1]=1n=n+1endif//-------------------------------------------------------------------------------////---Pivot low-------------------------------------------------------------------//if zz>zz[1] and zz[1]<zz[2] then$pivoty[n+1]=close[1]$pivotx[n+1]=barindex[1]$newhigh[n+1]=0n=n+1endif//-------------------------------------------------------------------------------////-------------------------------------------------------------------------------//if islastbarupdate thenfor i=n downto 3 do//drawpoint($pivotx[i],$pivoty[i],2)coloured("white")if $newhigh[i]=1 then////Populate all pointsl6xx=$pivotx[i]l6yy=$pivoty[i]l5xx=$pivotx[max(0,i-1)]l5yy=$pivoty[max(0,i-1)]l4xx=$pivotx[max(0,i-2)]l4yy=$pivoty[max(0,i-2)]l3xx=$pivotx[max(0,i-3)]l3yy=$pivoty[max(0,i-3)]l2xx=$pivotx[max(0,i-4)]l2yy=$pivoty[max(0,i-4)]l1xx=$pivotx[max(0,i-5)]l1yy=$pivoty[max(0,i-5)]l0xx=$pivotx[max(0,i-6)]l0yy=$pivoty[max(0,i-6)]l7xx=$pivotx[i+1]l7yy=$pivoty[i+1]l8xx=$pivotx[i+2]l8yy=$pivoty[i+2]////Checking waves performanceww1=l0yy-l1yyww2=l2yy-l1yyww3=l2yy-l3yyww4=l4yy-l3yyww5=l4yy-l5yywwA=l6yy-l5yywwB=l6yy-l7yywwC=l8yy-l7yyminww=min(ww1,min(ww3,ww5))checkDN0=ww1>0 and ww3>0 and ww5>0 and ww2>0 and ww4>0 and wwA>0 and wwB>0 and wwC>0//Checking levels//Wave 1://No specific strict conditions other than being the start of a new trend.//Wave 2:checkDN1=l2yy<=l0yy//Must not retrace more than 100% of Wave 1.//Wave 3:checkDN2=ww3<>minWw// Cannot be the shortest among Waves 1, 3, and 5.checkDN3=l3yy<l1yy//Must exceed the end of Wave 1.checkDN4=ww3>ww1//Must be greater in price than Wave 1.//Wave 4:checkDN5=l4yy<l1yy//Must not overlap with the price range of Wave 1 (in futures or highly leveraged markets, this rule can be violated, but in stock markets, it is strict).//Wave 5:checkDN6=l5yy<l3yycheckDN7=l6yy<l2yy//Waves A-B-CcheckDN8=l7yy>=l5yy//Wave B must not retrace more than 100% of Wave AcheckDN9=l8yy>=l6yy//SetupsetupDNTrend=checkDN0 and checkDN1 and checkDN2 and checkDN3 and checkDN4 and checkDN5 and checkDN6 and checkDN7 and checkDN8 and checkDN9if setupDNTrend thendrawsegment(l7xx,l7yy,l8xx,l8yy)coloured("white")style(line,2)drawsegment(l7xx,l7yy,l6xx,l6yy)coloured("white")style(line,2)drawsegment(l5xx,l5yy,l6xx,l6yy)coloured("white")style(line,2)drawsegment(l5xx,l5yy,l4xx,l4yy)coloured("red")style(line,2)drawsegment(l3xx,l3yy,l4xx,l4yy)coloured("red")style(line,2)drawsegment(l3xx,l3yy,l2xx,l2yy)coloured("red")style(line,2)drawsegment(l1xx,l1yy,l2xx,l2yy)coloured("red")style(line,2)drawsegment(l1xx,l1yy,l0xx,l0yy)coloured("red")style(line,2)drawtext("(0)",l0xx,l0yy+0.15*tr)coloured("yellow")drawtext("(1)",l1xx,l1yy-0.15*tr)coloured("yellow")drawtext("(2)",l2xx,l2yy+0.15*tr)coloured("yellow")drawtext("(3)",l3xx,l3yy-0.15*tr)coloured("yellow")drawtext("(4)",l4xx,l4yy+0.15*tr)coloured("yellow")drawtext("(5)",l5xx,l5yy-0.15*tr)coloured("yellow")drawtext("(6)",l6xx,l6yy+0.15*tr)coloured("yellow")endifelsif $newhigh[i]=0 then//Populate all pointsl6x=$pivotx[i]l6y=$pivoty[i]l5x=$pivotx[max(0,i-1)]l5y=$pivoty[max(0,i-1)]l4x=$pivotx[max(0,i-2)]l4y=$pivoty[max(0,i-2)]l3x=$pivotx[max(0,i-3)]l3y=$pivoty[max(0,i-3)]l2x=$pivotx[max(0,i-4)]l2y=$pivoty[max(0,i-4)]l1x=$pivotx[max(0,i-5)]l1y=$pivoty[max(0,i-5)]l0x=$pivotx[max(0,i-6)]l0y=$pivoty[max(0,i-6)]l7x=$pivotx[i+1]l7y=$pivoty[i+1]l8x=$pivotx[i+2]l8y=$pivoty[i+2]//Checking waves and conditionsw1=l1y-l0yw2=l1y-l2yw3=l3y-l2yw4=l3y-l4yw5=l5y-l4ywA=l5y-l6ywB=l7y-l6ywC=l7y-l8ycheckUP0=w1>0 and w3>0 and w5>0 and w2>0 and w4>0 and wA>0 and wB>0 and wC>0//Wave 1://No specific strict conditions other than being the start of a new trend.//Wave 2:checkUP1=l2y>=l0y//Must not retrace more than 100% of Wave 1.//Wave 3:minw=min(w1,min(w3,w5))//checkUP2=w3<>minW// Cannot be the shortest among Waves 1, 3, and 5.checkUP3=l3y>l1y//Must exceed the end of Wave 1.checkUP4=w3>w1//Must be greater in price than Wave 1.//Wave 4:checkUP5=l4y>l1y//Must not overlap with the price range of Wave 1 (in futures or highly leveraged markets, this rule can be violated, but in stock markets, it is strict).//Wave 5: Wave 5 must extend beyond the end of Wave 3.checkUP6=l5y>l3ycheckUP7=l6y>l2y//Waves A-B-CcheckUP8=l7y<=l5y//Wave B must not retrace more than 100% of Wave AcheckUP9=l8y<=l6y//SetupsetupUpTrend=checkUP0 and checkUP1 and checkUP2 and checkUP3 and checkUP4 and checkUP5 and checkUP6 and checkUP7 and checkUP8 and checkUP9//Draw wavesif setupUpTrend thendrawsegment(l7x,l7y,l8x,l8y)coloured("white")style(line,2)drawsegment(l7x,l7y,l6x,l6y)coloured("white")style(line,2)drawsegment(l5x,l5y,l6x,l6y)coloured("white")style(line,2)drawsegment(l5x,l5y,l4x,l4y)coloured("blue")style(line,2)drawsegment(l3x,l3y,l4x,l4y)coloured("blue")style(line,2)drawsegment(l3x,l3y,l2x,l2y)coloured("blue")style(line,2)drawsegment(l1x,l1y,l2x,l2y)coloured("blue")style(line,2)drawsegment(l1x,l1y,l0x,l0y)coloured("blue")style(line,2)drawtext("(0)",l0x,l0y-0.15*tr)coloured("yellow")drawtext("(1)",l1x,l1y+0.15*tr)coloured("yellow")drawtext("(2)",l2x,l2y-0.15*tr)coloured("yellow")drawtext("(3)",l3x,l3y+0.15*tr)coloured("yellow")drawtext("(4)",l4x,l4y-0.15*tr)coloured("yellow")drawtext("(5)",l5x,l5y+0.15*tr)coloured("yellow")drawtext("(6)",l6x,l6y-0.15*tr)coloured("yellow")endifendifnextendif//-------------------------------------------------------------------------------//return zz as "ZigZag" coloured("yellow",150)1 user thanked author for this post.
07/17/2024 at 1:18 PM #23538907/17/2024 at 1:50 PM #23539607/17/2024 at 2:31 PM #23539807/17/2024 at 2:32 PM #235399any ideas what is it
Copy and paste error … place cursor just before the red lined error and hit return and you should be good to go?
PS / Edit
Ha, we are ‘falling over ourselves’ to be helpful! 😉
07/17/2024 at 2:38 PM #235401Link to Ivan’s Elliott Wave Indicator code above, added as Log 391 here …
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on