// 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' )
//-----------------------------------------------------------------------------}
// TP Targets Settings
show_tp = input.bool(true, title=""عرض الأهداف, group="TP Targets")
target_source = input.string("0 → 3", title=""قياس الأهداف من, options=["0 → 3", "0
→ 5"], group="TP Targets")
tp1_ratio = input.float(1.272, title="TP1 "نسبة, group="TP Targets", minval=0.1,
step=0.001)
tp2_ratio = input.float(1.618, title="TP2 "نسبة, group="TP Targets", minval=0.1,
step=0.001)
tp3_ratio = input.float(2.000, title="TP3 "نسبة, group="TP Targets", minval=0.1,
step=0.001)
tp4_ratio = input.float(2.618, title="TP4 "نسبة, group="TP Targets", minval=0.1,
step=0.001)
var line[] tp_lines = array.new_line()
var label[] tp_labels = array.new_label()
clear_tps() =>
for l in tp_lines
line.delete(l)
array.clear(tp_lines)
for lb in tp_labels
label.delete(lb)
array.clear(tp_labels)
plot_tp_targets(x0, y0, xRef, yRef, isBullish) =>
clear_tps()
ratios = [tp1_ratio, tp2_ratio, tp3_ratio, tp4_ratio]
names = ["TP1", "TP2", "TP3", "TP4"]
diff = yRef - y0
for i = 0 to 3
ratio = ratios[i]
name = names[i]
target_y = yRef + (isBullish ? 1 : -1) * diff * ratio
tp_line = line.new(x1=xRef, y1=target_y, x2=xRef + 10, y2=target_y,
color=color.new(color.lime, 20), width=1)
tp_label = label.new(x=xRef + 10, y=target_y, text=name,
style=label.style_label_left, color=color.new(color.green, 0),
textcolor=color.black, size=size.tiny)
array.push(tp_lines, tp_line)
array.push(tp_labels, tp_label)
//-----------------------------------------------------------------------------}
//Plots
//-----------------------------------------------------------------------------{
draw(s1, len1, col1, 0)
draw(s2, len2, col2, 1)
draw(s3, len3, col3, 2)
if barstate.islast and show_tp and aEW.size() > 0
last_wave = aEW.get(0)
if last_wave.on and not na(last_wave.l5)
x0 = target_source == "0 → 3" ? last_wave.l3.get_x2() :
last_wave.l5.get_x1()
y0 = target_source == "0 → 3" ? last_wave.l3.get_y2() :
last_wave.l5.get_y1()
xRef = last_wave.l5.get_x2()
yRef = last_wave.l5.get_y2()
isBull = last_wave.dir == 1
plot_tp_targets(x0, y0, xRef, yRef, isBull)
//-----------------------------------------------------------------------------}