Traduzione codice dochan zig zag Trading View
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Traduzione codice dochan zig zag Trading View
- This topic has 1 reply, 2 voices, and was last updated 3 months ago by Iván.
-
-
05/05/2023 at 9:22 AM #214169
Buongiorno,
vorrei proporre cortese traduzione di questo codice che mi sembra interessante e che combina il donchian channel con la logica del zig zag, esplicitando graficamente questa relazione.
Grazie
// This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo//@version=4
study(“Donchian Zig-Zag [LuxAlgo]”,overlay=true)
h1 = input(true ,”───────── Indicator Settings ─────────”)
length = input(50)
src = input(close)
bsp = input(1.,”Bounce Speed”,minval=1)
h2 = input(true ,”────────── Plot Settings ───────────”)
gradient = input(“On” ,” Gradient”,options=[“On”,”Off”])
transp = input(80 ,” Transparency”,minval=0,maxval=100)
//──────────────────────────────────────────────────────────────────────────────
zigzag = 0.,osc = 0
var css = array.new_color(na)
if barstate.isfirst
array.push(css,#FF1100), array.push(css,#FF1200), array.push(css,#FF1400), array.push(css,#FF1500), array.push(css,#FF1700), array.push(css,#FF1800), array.push(css,#FF1A00), array.push(css,#FF1B00), array.push(css,#FF1D00), array.push(css,#FF1F00), array.push(css,#FF2000), array.push(css,#FF2200), array.push(css,#FF2300), array.push(css,#FF2500), array.push(css,#FF2600), array.push(css,#FF2800), array.push(css,#FF2900), array.push(css,#FF2B00), array.push(css,#FF2D00), array.push(css,#FF2E00), array.push(css,#FF3000), array.push(css,#FF3100), array.push(css,#FF3300), array.push(css,#FF3400), array.push(css,#FF3600), array.push(css,#FF3700), array.push(css,#FF3900), array.push(css,#FF3B00), array.push(css,#FF3C00), array.push(css,#FF3E00), array.push(css,#FF3F00), array.push(css,#FF4100), array.push(css,#FF4200), array.push(css,#FF4400), array.push(css,#FF4500), array.push(css,#FF4700), array.push(css,#FF4900), array.push(css,#FF4A00), array.push(css,#FF4C00), array.push(css,#FF4D00), array.push(css,#FF4F00), array.push(css,#FF5000), array.push(css,#FF5200), array.push(css,#FF5300), array.push(css,#FF5500), array.push(css,#FF5700), array.push(css,#FF5800), array.push(css,#FF5A00), array.push(css,#FF5B00), array.push(css,#FF5D00), array.push(css,#FF5E00), array.push(css,#FF6000), array.push(css,#FF6200), array.push(css,#FF6300), array.push(css,#FF6500), array.push(css,#FF6600), array.push(css,#FF6800), array.push(css,#FF6900), array.push(css,#FF6B00), array.push(css,#FF6C00), array.push(css,#FF6E00), array.push(css,#FF7000), array.push(css,#FF7100), array.push(css,#FF7300), array.push(css,#FF7400), array.push(css,#FF7600), array.push(css,#FF7700), array.push(css,#FF7900), array.push(css,#FF7A00), array.push(css,#FF7C00), array.push(css,#FF7E00), array.push(css,#FF7F00), array.push(css,#FF8100), array.push(css,#FF8200), array.push(css,#FF8400), array.push(css,#FF8500), array.push(css,#FF8700), array.push(css,#FF8800), array.push(css,#FF8A00), array.push(css,#FF8C00), array.push(css,#FF8D00), array.push(css,#FF8F00), array.push(css,#FF9000), array.push(css,#FF9200), array.push(css,#FF9300), array.push(css,#FF9500), array.push(css,#FF9600), array.push(css,#FF9800), array.push(css,#FF9A00), array.push(css,#FF9B00), array.push(css,#FF9D00), array.push(css,#FF9E00), array.push(css,#FFA000), array.push(css,#FFA100), array.push(css,#FFA300), array.push(css,#FFA400), array.push(css,#FFA600), array.push(css,#FFA800), array.push(css,#FFA900), array.push(css,#FFAB00), array.push(css,#FDAC00), array.push(css,#FBAD02), array.push(css,#F9AE03), array.push(css,#F7AE04), array.push(css,#F5AF06), array.push(css,#F3B007), array.push(css,#F1B108), array.push(css,#EFB20A), array.push(css,#EDB30B), array.push(css,#EBB30C), array.push(css,#E9B40E), array.push(css,#E7B50F), array.push(css,#E4B610), array.push(css,#E2B712), array.push(css,#E0B813), array.push(css,#DEB814), array.push(css,#DCB916), array.push(css,#DABA17), array.push(css,#D8BB18), array.push(css,#D6BC1A), array.push(css,#D4BD1B), array.push(css,#D2BD1C), array.push(css,#D0BE1E), array.push(css,#CEBF1F), array.push(css,#CCC020), array.push(css,#C9C122), array.push(css,#C7C223), array.push(css,#C5C224), array.push(css,#C3C326), array.push(css,#C1C427), array.push(css,#BFC528), array.push(css,#BDC62A), array.push(css,#BBC72B), array.push(css,#B9C72C), array.push(css,#B7C82E), array.push(css,#B5C92F), array.push(css,#B3CA30), array.push(css,#B0CB32), array.push(css,#AECC33), array.push(css,#ACCC34), array.push(css,#AACD36), array.push(css,#A8CE37), array.push(css,#A6CF38), array.push(css,#A4D03A), array.push(css,#A2D13B), array.push(css,#A0D13C), array.push(css,#9ED23E), array.push(css,#9CD33F), array.push(css,#9AD440), array.push(css,#98D542), array.push(css,#95D643), array.push(css,#93D644), array.push(css,#91D746), array.push(css,#8FD847), array.push(css,#8DD948), array.push(css,#8BDA4A), array.push(css,#89DB4B), array.push(css,#87DB4C), array.push(css,#85DC4E), array.push(css,#83DD4F), array.push(css,#81DE50), array.push(css,#7FDF52), array.push(css,#7CE053), array.push(css,#7AE054), array.push(css,#78E156), array.push(css,#76E257), array.push(css,#74E358), array.push(css,#72E45A), array.push(css,#70E55B), array.push(css,#6EE55C), array.push(css,#6CE65E), array.push(css,#6AE75F), array.push(css,#68E860), array.push(css,#66E962), array.push(css,#64EA63), array.push(css,#61EA64), array.push(css,#5FEB66), array.push(css,#5DEC67), array.push(css,#5BED68), array.push(css,#59EE6A), array.push(css,#57EF6B), array.push(css,#55EF6C), array.push(css,#53F06E), array.push(css,#51F16F), array.push(css,#4FF270), array.push(css,#4DF372), array.push(css,#4BF473), array.push(css,#48F474), array.push(css,#46F576), array.push(css,#44F677), array.push(css,#42F778), array.push(css,#40F87A), array.push(css,#3EF97B), array.push(css,#3CF97C), array.push(css,#3AFA7E), array.push(css,#38FB7F), array.push(css,#36FC80), array.push(css,#34FD82), array.push(css,#32FE83), array.push(css,#30FF85),
//──────────────────────────────────────────────────────────────────────────────
upper = highest(src,length),lower = lowest(src,length)
crossupper = cross(nz(zigzag[1],src),upper)
crosslower = cross(nz(zigzag[1],src),lower)
osc := crossupper ? -1 : crosslower ? 1 : osc[1]
val = valuewhen(change(osc),upper – lower,0)
zigzag := nz(zigzag[1],src) + osc*val/length*bsp
//──────────────────────────────────────────────────────────────────────────────
n = bar_index
var line extention = na
if change(osc)
extention := line.new(n[1],zigzag[1],n,zigzag,
extend=extend.right,color=#2157f3,style=line.style_dashed)
//──────────────────────────────────────────────────────────────────────────────
norm_css = sma(max(min((src-lower)/(upper – lower),1),0),length)
plot(zigzag,”Plot”,#2157f3,2)
up = plot(upper,”Upper”,na,1,editable=false)
dn = plot(lower,”Lower”,na,1,editable=false)
fill(up,dn,gradient == “On” ? array.get(css,round(norm_css*199)) :
color.gray,transp,editable=false)08/13/2024 at 5:19 PM #236379Bene, ecco il codice tradotto dall'indicatore.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879//-----------------------------------------------------------------////PRC_Donchian Zigzag//version = 0//13.08.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-----------------------------------------------------------------////-----Inputs------------------------------------------------------////-----------------------------------------------------------------//src=closelength=20bsp=1 //Bounce speedtransp=120gradient=1//-----------------------------------------------------------------////-----Donchian Upper and Lower------------------------------------////-----------------------------------------------------------------//upper=highest[length](src)lower=lowest[length](src)//-----------------------------------------------------------------////-----Zig-Zag-----------------------------------------------------////-----------------------------------------------------------------//once zz=srccrossupper=zz[1] crosses over upper or zz[1] crosses under uppercrosslower=zz[1] crosses over lower or zz[1] crosses under lowerif crossupper thenosc=-1elsif crosslower thenosc=1elseosc=oscendifif osc<>osc[1] thenval=upper-lowerendifif barindex > 2*length thenzz = zz[1]+osc*val*bsp/lengthendif//-----------------------------------------------------------------////-----Fill Donchian channel---------------------------------------////-----------------------------------------------------------------//source=max(min((src-lower)/(upper-lower),1),0)norm=average[length](source)if gradient thenif norm < 0.2 thenr=255g=0b=0elsif norm>=0.20 and norm<0.40 thenr=255g=168b=0elsif norm>=0.40 and norm<0.60 thenr=214g=188b=26elsif norm>=0.60 and norm<0.80 thenr=172g=204b=52elsif norm>=0.80 thenr=48g=255b=83endifelser=120g=120b=120endifcolorbetween(upper,lower,r,g,b,transp)//-----------------------------------------------------------------//return upper as "Lmax" , lower as "Lmin", zz as "ZigZag" coloured("blue")style(line,2) -
AuthorPosts
Find exclusive trading pro-tools on