ProRealCode - Trading & Coding with ProRealTime™
Iván: Veo que la mayor parte de foreros éstan pidiendo el Screener de cuando empieza la Onda 3 o bien la Extensión de Fibonacci con retroceso 0.618 %. Creo que primero tengo que empezar por conseguir el indicador para luego
hacer el Screener correspondiente.
Voy o vamos abusar un poco de tu confianza para ver si se puede conseguir la conversión de este indicador de Tradingview que acabo de visualizar, con el enlace:
https://es.tradingview.com/script/2nHEU4W8/
Gracias,
A continuación te voy a pasar la codificación:
| // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ | ||||
| // © ShunKK | ||||
| //@version=5 | ||||
| indicator(“fibs Retracement/Extension”, “fibs Retracement/Extension”, overlay = true, max_lines_count = 500, max_labels_count = 500) | ||||
| //—————————————————————————— | ||||
| //Settings | ||||
| //—————————————————————————–{ | ||||
| length = input.int(defval = 8,minval = 8,step = 1,group = ‘ZigZagLength’) | ||||
| //—————————————————————————–} | ||||
| //Data | ||||
| //—————————————————————————–{ | ||||
| var float phy = na | ||||
| var float ply = na | ||||
| var zigzagCh = 0 | ||||
| var ZigZagTopArr = array.new_float(0) | ||||
| var ZigZagBotArr = array.new_float(0) | ||||
| var ZigZagbarTopArr = array.new_int(0) | ||||
| var ZigZagbarBptArr = array.new_int(0) | ||||
| var ZigZagUpArr = array.new_line(0) | ||||
| var ZigZagDnArr = array.new_line(0) | ||||
| _array_add_section(_array,add_value)=> | ||||
| array.push(_array,add_value) | ||||
| _array_add_section2(_array,add_value)=> | ||||
| index = _array.size()-1 | ||||
| if index > 0 | ||||
| array.remove(_array,index) | ||||
| array.push(_array,add_value) | ||||
| _array_line_Set(_ZigZagTopArr,_ZigZagbarTopArr,_ZigZagBotArr,_ZigZagbarBptArr,_bar_index,_ZigZagUpArr,_ph,_phy,_zigzagCh,ZigZagtrend)=> | ||||
| _zigzagCh1 = _zigzagCh | ||||
| if ZigZagtrend | ||||
| if _zigzagCh == -1 | ||||
| if _ph > _phy | ||||
| _array_add_section2(_ZigZagTopArr,_ph) | ||||
| _array_add_section2(_ZigZagbarTopArr,_bar_index) | ||||
| idex = _ZigZagUpArr.size() -1 | ||||
| line.set_x2(_ZigZagUpArr.get(idex),_bar_index) | ||||
| line.set_y2(_ZigZagUpArr.get(idex),_ph) | ||||
| _zigzagCh1 := 1 | ||||
| else | ||||
| _array_add_section(_ZigZagTopArr,_ph) | ||||
| _array_add_section(_ZigZagbarTopArr,_bar_index) | ||||
| //Set label | ||||
| ZigTop = _ZigZagTopArr.size() -1 | ||||
| ZigBot = _ZigZagBotArr.size() -1 | ||||
| if ZigTop > 0 and ZigBot > 0 | ||||
| _array_add_section(_ZigZagUpArr,line.new(x1 = _ZigZagbarBptArr.get(ZigBot),y1 = _ZigZagBotArr.get(ZigBot),x2 = _ZigZagbarTopArr.get(ZigTop),y2 = _ZigZagTopArr.get(ZigTop),xloc = xloc.bar_index,color=color.new(color.gray,80),width = 2)) | ||||
| else | ||||
| if zigzagCh == 1 | ||||
| if _ph < _phy | ||||
| _array_add_section2(_ZigZagBotArr,_ph) | ||||
| _array_add_section2(_ZigZagbarBptArr,_bar_index) | ||||
| idex = _ZigZagUpArr.size() -1 | ||||
| line.set_x2(_ZigZagUpArr.get(idex),_bar_index) | ||||
| line.set_y2(_ZigZagUpArr.get(idex),_ph) | ||||
| _zigzagCh1 := -1 | ||||
| else | ||||
| //Set label | ||||
| _array_add_section(_ZigZagBotArr,_ph) | ||||
| _array_add_section(_ZigZagbarBptArr,_bar_index) | ||||
| ZigTop = _ZigZagTopArr.size() -1 | ||||
| ZigBot = _ZigZagBotArr.size() -1 | ||||
| if ZigTop > 0 and ZigBot > 0 | ||||
| _array_add_section(_ZigZagUpArr,line.new(x1 = _ZigZagbarTopArr.get(ZigTop),y1 = _ZigZagTopArr.get(ZigTop),x2 = _ZigZagbarBptArr.get(ZigBot),y2 = _ZigZagBotArr.get(ZigBot),xloc = xloc.bar_index,color=color.new(color.gray,80),width = 2)) | ||||
| _zigzagCh1 | ||||
| _Retracement_Set(_array1,_leg,_array2,_line)=> | ||||
| ZigZagLegindex = _array1.size() -1 – _leg | ||||
| _y1 = line.get_y1(_array1.get(ZigZagLegindex)) | ||||
| _y2 = line.get_y2(_array1.get(ZigZagLegindex)) | ||||
| _x1 = line.get_x1(_array1.get(ZigZagLegindex)) | ||||
| _x2 = bar_index | ||||
| for i = 0 to 6 | ||||
| fibline = fibs.retracement(_y1,_y2,_array2.get(i)) | ||||
| line.set_x1(_line.get(i),_x1) | ||||
| line.set_x2(_line.get(i),_x2) | ||||
| line.set_y1(_line.get(i),fibline) | ||||
| line.set_y2(_line.get(i),fibline) | ||||
| _Extension_Set(_array_A,_array_B,_array_C,_leg,_array2,_line,_array_X1,_array_X2,_array_X3,_line8_ex,_line9_ex,_color)=> | ||||
| ZigZagLegindex = _array_A.size() -1 – _leg | ||||
| _a = _array_A.get(ZigZagLegindex) | ||||
| _b = _array_B.get(ZigZagLegindex) | ||||
| _c = _array_C.get(ZigZagLegindex) | ||||
| _x1 = _array_X1.get(ZigZagLegindex) | ||||
| _x2 = _array_X2.get(ZigZagLegindex) | ||||
| _x3 = _array_X3.get(ZigZagLegindex) | ||||
| _line8_ex.set_xy1(_x3,_a) | ||||
| _line8_ex.set_xy2(_x1,_b) | ||||
| _line8_ex.set_color(_color) | ||||
| _line9_ex.set_xy1(_x1,_b) | ||||
| _line9_ex.set_xy2(_x2,_c) | ||||
| _line9_ex.set_color(_color) | ||||
| for i = 0 to 7 | ||||
| fibline = fibs.extension(_a,_b,_c,_array2.get(i)) | ||||
| line.set_x1(_line.get(i),_x1) | ||||
| line.set_x2(_line.get(i),_x2) | ||||
| line.set_y1(_line.get(i),fibline) | ||||
| line.set_y2(_line.get(i),fibline) | ||||
| _Extension_array_Set(_array_A,_fibExt_A,_fibExt_B,_fibExt_C,_ExtensionSet_x1,_ExtensionSet_x2,_ExtensionSet_x3,_trendSw)=> | ||||
| for i = 1 to _array_A.size() -1 | ||||
| _a = line.get_y2(_array_A.get(i-1)) | ||||
| _b = line.get_y1(_array_A.get(i)) | ||||
| _c = line.get_y2(_array_A.get(i)) | ||||
| _x1 = line.get_x1(_array_A.get(i)) | ||||
| _x2 = line.get_x2(_array_A.get(i)) | ||||
| _x3 = line.get_x2(_array_A.get(i-1)) | ||||
| if _trendSw | ||||
| if _a < _c | ||||
| _array_add_section(_fibExt_A,_a) | ||||
| _array_add_section(_fibExt_B,_b) | ||||
| _array_add_section(_fibExt_C,_c) | ||||
| _array_add_section(_ExtensionSet_x1,_x1) | ||||
| _array_add_section(_ExtensionSet_x2,_x2) | ||||
| _array_add_section(_ExtensionSet_x3,_x3) | ||||
| else | ||||
| if _a > _c | ||||
| _array_add_section(_fibExt_A,_a) | ||||
| _array_add_section(_fibExt_B,_b) | ||||
| _array_add_section(_fibExt_C,_c) | ||||
| _array_add_section(_ExtensionSet_x1,_x1) | ||||
| _array_add_section(_ExtensionSet_x2,_x2) | ||||
| _array_add_section(_ExtensionSet_x3,_x3) | ||||
| o = open[length] | ||||
| h = high[length] | ||||
| l = low[length] | ||||
| c = close[length] | ||||
| d = math.abs(c – o) | ||||
| ph = ta.pivothigh(length, length) | ||||
| pl = ta.pivotlow(length, length) | ||||
| //—————————————————————————–} | ||||
| //Set labels | ||||
| //—————————————————————————–{ | ||||
| n = bar_index | ||||
| var ZigTop = 0 | ||||
| var ZigBot = 0 | ||||
| if ph | ||||
| zigzagCh := _array_line_Set(ZigZagTopArr,ZigZagbarTopArr,ZigZagBotArr,ZigZagbarBptArr,n[length],ZigZagUpArr,ph,phy,zigzagCh,true) | ||||
| phy := ph | ||||
| zigzagCh := -1 | ||||
| else if pl | ||||
| zigzagCh := _array_line_Set(ZigZagTopArr,ZigZagbarTopArr,ZigZagBotArr,ZigZagbarBptArr,n[length],ZigZagDnArr,pl,ply,zigzagCh,false) | ||||
| ply := pl | ||||
| zigzagCh := 1 | ||||
| //—————————————————————————–} | ||||
| TrendSw = input.int(defval = 1,title = ‘FibTrend [1 :Bull] ,[-1:Bear],[0.:None]’,options = [0,1,-1],group = ‘FibsConfing_Trend’) | ||||
| ZigZagleg = input.int(defval = 1,minval = 0,title = ‘FibRetraceSet CountBack’ ,group = ‘FibsConfing_Rit’) | ||||
| TrendSw_Ex = TrendSw | ||||
| ZigZagleg_Ex = input.int(defval = 0,minval = 0,title = ‘FibExtensionSet CountBack’ ,group = ‘FibsConfing_Ext’) | ||||
| import HeWhoMustNotBeNamed/FibRatios/1 as fibs | ||||
| var fibarray = array.new_float(0) | ||||
| var fibarray2 = array.new_float(0) | ||||
| var fibarrayline = array.new_line(0) | ||||
| var fibarrayline2 = array.new_line(0) | ||||
| var fibarrayline3 = array.new_line(0) | ||||
| var fibarrayline4 = array.new_line(0) | ||||
| var fibSetSw = true | ||||
| var line0 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.gray ,40)) | ||||
| var line1 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.red ,40)) | ||||
| var line2 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.orange,40)) | ||||
| var line3 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.green ,40)) | ||||
| var line4 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.blue ,40)) | ||||
| var line5 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.aqua ,40)) | ||||
| var line6 = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.gray ,40)) | ||||
| var line0_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.gray ,40)) | ||||
| var line1_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.red ,40)) | ||||
| var line2_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.orange,40)) | ||||
| var line3_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.green ,40)) | ||||
| var line4_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.blue ,40)) | ||||
| var line5_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.aqua ,40)) | ||||
| var line6_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.white ,40)) | ||||
| var line7_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.gray ,40)) | ||||
| var line8_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.white ,0),style = line.style_dashed,width = 3) | ||||
| var line9_ex = line.new(0, low, bar_index, high, extend=extend.none,xloc = xloc.bar_index,color=color.new(color.white ,0),style = line.style_dashed,width = 3) | ||||
| var fibExt_A = array.new_float(0) | ||||
| var fibExt_B = array.new_float(0) | ||||
| var fibExt_C = array.new_float(0) | ||||
| var fibExt_AA = array.new_float(0) | ||||
| var fibExt_BB = array.new_float(0) | ||||
| var fibExt_CC = array.new_float(0) | ||||
| var ExtensionSet_x1 = array.new_int(0) | ||||
| var ExtensionSet_x2 = array.new_int(0) | ||||
| var ExtensionSet_x3 = array.new_int(0) | ||||
| var ExtensionSet_x1a = array.new_int(0) | ||||
| var ExtensionSet_x2a = array.new_int(0) | ||||
| var ExtensionSet_x3a = array.new_int(0) | ||||
| if fibSetSw | ||||
| fibSetSw := false | ||||
| fibarray.insert(0,0.0) | ||||
| fibarrayline.insert(0,line0) | ||||
| fibarray.insert(1,0.236) | ||||
| fibarrayline.insert(1,line1) | ||||
| fibarray.insert(2,0.382) | ||||
| fibarrayline.insert(2,line2) | ||||
| fibarray.insert(3,0.5) | ||||
| fibarrayline.insert(3,line3) | ||||
| fibarray.insert(4,0.618) | ||||
| fibarrayline.insert(4,line4) | ||||
| fibarray.insert(5,0.786) | ||||
| fibarrayline.insert(5,line5) | ||||
| fibarray.insert(6,1.0) | ||||
| fibarrayline.insert(6,line6) | ||||
| fibarray2.insert(0,0.618) | ||||
| fibarrayline2.insert(0,line0_ex) | ||||
| fibarray2.insert(1,1.0) | ||||
| fibarrayline2.insert(1,line1_ex) | ||||
| fibarray2.insert(2,1.382) | ||||
| fibarrayline2.insert(2,line2_ex) | ||||
| fibarray2.insert(3,1.618) | ||||
| fibarrayline2.insert(3,line3_ex) | ||||
| fibarray2.insert(4,2.382) | ||||
| fibarrayline2.insert(4,line4_ex) | ||||
| fibarray2.insert(5,2.618) | ||||
| fibarrayline2.insert(5,line5_ex) | ||||
| fibarray2.insert(6,3.618) | ||||
| fibarrayline2.insert(6,line6_ex) | ||||
| fibarray2.insert(7,4.236) | ||||
| fibarrayline2.insert(7,line7_ex) | ||||
| linefill.new(line2_ex,line3_ex,TrendSw_Ex == 1 ? color.new(color.lime,90) : TrendSw_Ex == -1 ? color.new(color.red,90) : na) | ||||
| linefill.new(line4_ex,line5_ex,TrendSw_Ex == 1 ? color.new(color.lime,90) : TrendSw_Ex == -1 ? color.new(color.red,90) : na) | ||||
| linefill.new(line6_ex,line7_ex,TrendSw_Ex == 1 ? color.new(color.lime,90) : TrendSw_Ex == -1 ? color.new(color.red,90) : na) | ||||
| linefill.new(line6,line4,TrendSw == 1 ? color.new(color.lime,90) : TrendSw == -1 ? color.new(color.red,90) : na) | ||||
| var fibsw = false | ||||
| var fibsw2 = false | ||||
| var ZigZagCheck1 =0,var ZigZagCheck2 = 0,ZigZagCheck3 = 0,ZigZagCheck4 = 0 | ||||
| var ZigZagCheck1_bk =0,var ZigZagCheck2_bk = 0,ZigZagCheck3_bk = 0,ZigZagCheck4_bk = 0 | ||||
| if TrendSw != 0 and zigzagCh != zigzagCh[1] | ||||
| ZigZagCheck1 := ZigZagUpArr.size() -1 – ZigZagleg | ||||
| if ZigZagCheck1 >= 0 and TrendSw == 1 and zigzagCh == -1 and ZigZagCheck1_bk != ZigZagCheck1 | ||||
| ZigZagCheck1_bk := ZigZagCheck1 | ||||
| _Retracement_Set(ZigZagUpArr,ZigZagleg,fibarray,fibarrayline) | ||||
| fibsw := true | ||||
| ZigZagCheck2 := ZigZagDnArr.size() -1 – ZigZagleg | ||||
| if ZigZagCheck2 >= 0 and TrendSw == -1 and zigzagCh == 1 and ZigZagCheck2 != ZigZagCheck2_bk | ||||
| ZigZagCheck2_bk := ZigZagCheck2 | ||||
| _Retracement_Set(ZigZagDnArr,ZigZagleg,fibarray,fibarrayline) | ||||
| fibsw := true | ||||
| if TrendSw_Ex != 0 and zigzagCh != zigzagCh[1] | ||||
| if TrendSw_Ex == 1 and ZigZagDnArr.size() -1 > 1 and zigzagCh == 1 | ||||
| _Extension_array_Set(ZigZagDnArr,fibExt_A,fibExt_B,fibExt_C,ExtensionSet_x1,ExtensionSet_x2,ExtensionSet_x3,true) | ||||
| if TrendSw_Ex == -1 and ZigZagUpArr.size() -1 > 1 and zigzagCh == -1 | ||||
| _Extension_array_Set(ZigZagUpArr,fibExt_AA,fibExt_BB,fibExt_CC,ExtensionSet_x1a,ExtensionSet_x2a,ExtensionSet_x3a,false) | ||||
| ZigZagCheck3 := fibExt_A.size() -1 – ZigZagleg_Ex | ||||
| if ZigZagCheck3 >= 0 and TrendSw_Ex == 1 and ZigZagCheck3 != ZigZagCheck3_bk | ||||
| ZigZagCheck3_bk := ZigZagCheck3 | ||||
| fibsw2 := true | ||||
| _Extension_Set(fibExt_A,fibExt_B,fibExt_C,ZigZagleg_Ex,fibarray2,fibarrayline2,ExtensionSet_x1,ExtensionSet_x2,ExtensionSet_x3,line8_ex,line9_ex,color.white) | ||||
| ZigZagCheck4 := fibExt_AA.size() -1 – ZigZagleg_Ex | ||||
| if ZigZagCheck4 >= 0 and TrendSw_Ex == -1 and ZigZagCheck4 != ZigZagCheck4_bk | ||||
| ZigZagCheck4_bk := ZigZagCheck4 | ||||
| fibsw2 := true | ||||
| _Extension_Set(fibExt_AA,fibExt_BB,fibExt_CC,ZigZagleg_Ex,fibarray2,fibarrayline2,ExtensionSet_x1a,ExtensionSet_x2a,ExtensionSet_x3a,line8_ex,line9_ex,color.white) | ||||
| if barstate.islast and fibsw | ||||
| for i = 0 to 6 | ||||
| line.set_x2(fibarrayline.get(i),bar_index) | ||||
| if barstate.islast and fibsw2 | ||||
| for i = 0 to 7 | ||||
| line.set_x2(fibarrayline2.get(i),bar_index) | ||||
Aquí va el indicador.
defparam drawonlastbaronly=true
//----------------------------------------------------------------------------//
//PRC_Fibonacci Retracement / Extension
//version = 0
//07.02.2025
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//----------------------------------------------------------------------------//
//-----Inputs-----------------------------------------------------------------//
//ZZpercent=1
//prd=8
//percent=5
//N=1 // check last n zig
//checkUp=1 // check uptrend or downtrend
//----------------------------------------------------------------------------//
atr=averagetruerange[14](close) //Only drawing porpouse
//----------------------------------------------------------------------------//
//-----Pivots High&Low--------------------------------------------------------//
if ZZpercent then
//-----Mode Percent--------------------------------------------------------//
zz = zigzag[percent](close)
ph = zz<zz[1] and zz[1]>zz[2]
pl = zz>zz[1] and zz[1]<zz[2]
//-----Mode Highest/lowest Values------------------------------------------//
else
ph = high=highest[prd](high)
pl = low=lowest[prd](low)
endif
//----------------------------------------------------------------------------//
//-----Direction Calculation--------------------------------------------------//
if ph and pl=0 then
dir=1
elsif pl and ph=0 then
dir=-1
else
dir=dir
endif
dirchanged=dir<>dir[1]
//----------------------------------------------------------------------------//
//-----Calculate Arrays for each pivot----------------------------------------//
if ph or pl then
if dirchanged then
if dir=1 and not ZZpercent then
$zigzag[t+1]=highest[prd](high)
$zigzagidx[t+1]=barindex
$dir[t+1]=1
t=t+1
elsif dir=-1 and not ZZpercent then
$zigzag[t+1]=lowest[prd](low)
$zigzagidx[t+1]=barindex
$dir[t+1]=-1
t=t+1
elsif dir=1 and ZZpercent then
$zigzag[t+1]=zz[1]
$zigzagidx[t+1]=barindex[1]
$dir[t+1]=1
t=t+1
elsif dir=-1 and ZZpercent then
$zigzag[t+1]=zz[1]
$zigzagidx[t+1]=barindex[1]
$dir[t+1]=-1
t=t+1
endif
else
if not ZZpercent then
if dir=1 and highest[prd](high)> $zigzag[t] then
$zigzag[t]=highest[prd](high)
$zigzagidx[t]=barindex
elsif dir=-1 and lowest[prd](low)< $zigzag[t] then
$zigzag[t]=lowest[prd](low)
$zigzagidx[t]=barindex
endif
endif
endif
endif
//----------------------------------------------------------------------------//
//-----Drawing conditions-----------------------------------------------------//
if islastbarupdate then
//-----Draw zig-zag--------------------------------------------------------//
for i=1 to t do
drawsegment($zigzagidx[max(0,i-1)],$zigzag[max(0,i-1)],$zigzagidx[i],$zigzag[i])coloured("grey",75)style(line,2)
next
//-----Draw Last N Zig and Fibonacci Levels---------------------------------//
if $dir[t]=1 and checkUp then
pos=t-2*N
elsif $dir[t]=1 and not checkUp then
pos=t-2*N-1
elsif $dir[t]=-1 and checkUp then
pos=t-2*N-1
elsif $dir[t]=-1 and not checkUp then
pos=t-2*N
endif
drawsegment($zigzagidx[max(0,pos-1)],$zigzag[max(0,pos-1)],$zigzagidx[max(0,pos)],$zigzag[max(0,pos)])
drawpoint($zigzagidx[max(0,pos-1)],$zigzag[max(0,pos-1)],2)coloured("blue",100)
drawpoint($zigzagidx[max(0,pos)],$zigzag[max(0,pos)],2)coloured("blue",100)
if $dir[t]=1 then
//-----Calculation when trend Up----------------------------------------//
fib0=$zigzag[max(0,pos-1)]
fib100=$zigzag[max(0,pos)]
diff=fib100-fib0
fib0236=fib100-diff*0.236
fib0382=fib100-diff*0.382
fib0500=fib100-diff*0.500
fib0618=fib100-diff*0.618
fib0786=fib100-diff*0.786
if t>pos then
extdiff=fib100-$zigzag[max(0,pos+1)]
else
extdiff=diff
endif
fib1618=fib100+extdiff*0.618
fib2000=fib100+extdiff*1.0
fib2382=fib100+extdiff*1.382
fib2618=fib100+extdiff*1.618
fib3382=fib100+extdiff*2.382
fib3618=fib100+extdiff*2.618
fib4618=fib100+extdiff*3.618
fib5236=fib100+extdiff*4.236
drawsegment($zigzagidx[max(0,pos-1)],fib0,barindex+10,fib0)style(line,2)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib0236,barindex+10,fib0236)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib0382,barindex+10,fib0382)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib0500,barindex+10,fib0500)style(dottedline,2)coloured("blue")
drawsegment($zigzagidx[max(0,pos-1)],fib0618,barindex+10,fib0618)style(dottedline,2)coloured("red")
drawsegment($zigzagidx[max(0,pos-1)],fib0786,barindex+10,fib0786)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib100,barindex+10,fib100)style(line,2)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib1618,barindex+10,fib1618)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib2000,barindex+10,fib2000)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib2382,barindex+10,fib2382)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib2618,barindex+10,fib2618)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib3382,barindex+10,fib3382)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib3618,barindex+10,fib3618)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib4618,barindex+10,fib4618)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib5236,barindex+10,fib5236)style(dottedline,1)coloured("grey")
drawrectangle($zigzagidx[max(0,pos-1)],fib1618,barindex+10,fib2000)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib2382,barindex+10,fib2618)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib3382,barindex+10,fib3618)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib4618,barindex+10,fib5236)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib0,barindex+10,fib0618)style(dottedline,1)coloured("grey",0)fillcolor("blue",30)
drawtext("Fib 0%: #fib0#",barindex+10,fib100+0.05*atr)
drawtext("Fib 50%: #fib0500#",barindex+10,fib0500+0.05*atr)
drawtext("Fib 100%: #fib100#",barindex+10,fib0+0.05*atr)
elsif $dir[t]=-1 then
//-----Calculation when trend Down--------------------------------------//
fib0=$zigzag[max(0,pos)]
fib100=$zigzag[max(0,pos-1)]
diff=fib100-fib0
fib0236=fib0+diff*0.236
fib0382=fib0+diff*0.382
fib0500=fib0+diff*0.500
fib0618=fib0+diff*0.618
fib0786=fib0+diff*0.786
if t>pos then
extdiff=$zigzag[max(0,pos+1)]-fib0
else
extdiff=diff
endif
fib1618 = fib0 - extdiff * 0.618
fib2000 = fib0 - extdiff * 1.0
fib2382 = fib0 - extdiff * 1.382
fib2618 = fib0 - extdiff * 1.618
fib3382 = fib0 - extdiff * 2.382
fib3618 = fib0 - extdiff * 2.618
fib4618 = fib0 - extdiff * 3.618
fib5236 = fib0 - extdiff * 4.236
drawsegment($zigzagidx[max(0,pos-1)],fib0,barindex+10,fib0)style(line,2)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib0236,barindex+10,fib0236)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib0382,barindex+10,fib0382)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib0500,barindex+10,fib0500)style(dottedline,2)coloured("blue")
drawsegment($zigzagidx[max(0,pos-1)],fib0618,barindex+10,fib0618)style(dottedline,2)coloured("red")
drawsegment($zigzagidx[max(0,pos-1)],fib0786,barindex+10,fib0786)style(dottedline,1)coloured("grey")
drawsegment($zigzagidx[max(0,pos-1)],fib100,barindex+10,fib100)style(line,2)coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib1618, barindex + 10, fib1618) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib2000, barindex + 10, fib2000) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib2382, barindex + 10, fib2382) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib2618, barindex + 10, fib2618) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib3382, barindex + 10, fib3382) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib3618, barindex + 10, fib3618) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib4618, barindex + 10, fib4618) style(dottedline, 1) coloured("grey")
drawsegment($zigzagidx[max(0, pos-1)], fib5236, barindex + 10, fib5236) style(dottedline, 1) coloured("grey")
drawrectangle($zigzagidx[max(0,pos-1)],fib1618,barindex+10,fib2000)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib2382,barindex+10,fib2618)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib3382,barindex+10,fib3618)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib4618,barindex+10,fib5236)style(dottedline,1)coloured("grey",0)fillcolor("orange",30)
drawrectangle($zigzagidx[max(0,pos-1)],fib100,barindex+10,fib0618)style(dottedline,1)coloured("grey",0)fillcolor("blue",30)
drawtext("Fib 0%: #fib0#",barindex+10,fib0+0.05*atr)
drawtext("Fib 50%: #fib0500#",barindex+10,fib0500+0.05*atr)
drawtext("Fib 100%: #fib100#",barindex+10,fib100+0.05*atr)
endif
endif
return
Buenas
Hice la comprobación del indicador en un gráfico de MTS de 1 Hora y las extensiones están clavadas. Eso indica IVAN que clavaste la idea.
No obstante si se pudiesen modificar el texto, creo que sería más ilustrativo.
Me explico mejor, en lugar de marcar los niveles Fibonacci del 0 al 100% (Longitud que va entre el inicio del pivote 1 y del pivote 2).
Deberíamos poner sobre las extensiones dichos porcentajes. Por supuesto si esto fuera posible.
Es fabuloso lo que hiciste.
GRACIAS
Se me olvido el gráfico que adjunto
Hola! me alegro que funcione.
El texto lo puedes añadir fácilmente. Sólo tienes que modificar las líneas 152-154 y 206-208 por los niveles que necesites. Puedes incluso añadir más líneas siguiendo esa estructura.
Necesito Indicador para valores que estén empezando la onda 3 de elliott
This topic contains 4 replies,
has 2 voices, and was last updated by
Iván González
12 months ago.
| Forum: | ProBuilder: Indicadores y Herramientas |
| Language: | Spanish |
| Started: | 02/03/2025 |
| Status: | Active |
| Attachments: | 1 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.