The ZigZag SupDem Zones Indicator detects support and resistance (supply and demand) zones using peaks and troughs formed by the ZigZag.
Depending on the timeframe used, it is necessary to set the necessary percentage to form a new peak or trough, by default that is set to 3%, ideal for most instruments on a unit of daily time.
The detection will be done only on the last periods set by the variable “lookback”.
The detection is validated if the indicator finds at least “minPoints” troughs or peaks not more distant than at most “threshold” in percentage.
- percent = 3 (percentage change of ZigZag to get new peaks and troughs, new swings)
- lookback = 200 (the period to search for supports and resistances)
- threshold = 1 (percentage to validate another zigzag from the one previously found to validate a support or a resistance)
- minPoint = 2 (at least it takes 2 swings of the same type, located one another less than “threshold” percent to validate a support or resistance)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
//PRC_ZigZag SupDem | indicator //13.03.2019 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge defparam drawonlastbaronly=true defparam calculateonlastbars=1000 // --- settings percent = 3 //zigzag percent lookback = 100 //max history lookback threshold = 1 //price percent between 2 ZZ points minPoint = 2 //minimal points to confirm S/R showSupport = 1 //plot support zones or not? (0=false;1=true) showResistance = 1 //plot resistance zones or not? (0=false;1=true) // --- end of settings //zz s/r zz = ZigZag[percent](customclose) p = zz<zz[1] and zz[1]>zz[2] t = zz>zz[1] and zz[1]<zz[2] if p then top = zz[1] endif if t then bottom = zz[1] endif once minPoint = max(2,minPoint) for i = 1 to lookback do if showResistance then //new peak if p[i] then topdata = top[i] hhtop = topdata+(customclose[i]*(threshold/100)) lltop = topdata-(customclose[i]*(threshold/100)) resttest=0 for y = i to lookback do resttest = resttest + (top[y]<hhtop and top[y]>lltop) if resttest>=minPoint then //drawarrowdown(barindex[i],topdata) coloured(255,0,0) drawsegment(barindex[lookback],topdata,barindex[1],topdata) coloured(255,0,0) break endif next endif endif if showSupport then //new through if t[i] then data = bottom[i] hh = data+(customclose[i]*(threshold/100)) ll = data-(customclose[i]*(threshold/100)) suptest=0 for y = i to lookback do suptest = suptest + (bottom[y]<hh and bottom[y]>ll) if suptest>=minPoint then //drawarrowup(barindex[i],data) coloured(0,255,0) drawsegment(barindex[lookback],data,barindex[1],data) coloured(0,255,0) break endif next endif endif next hprice = highest[lookback](customclose) lprice = lowest[lookback](customclose) drawsegment(barindex[lookback],hprice,barindex,hprice) drawsegment(barindex[lookback],lprice,barindex,lprice) return |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hola Nicolas,tengo un problema cuando importo el .itf pone que esta instalado correctamente,pero cuando lo añado ,se añade debajo del precio en una ventana nueva,como si fuese un rsi o un macd…me salen las velas de frenada y compra, pero me salen por abajo no en el mismo precio…como podría arreglarlo ?
Felicidades por el trabajo realizado.
añadirlo al precio
Hola Nicolas,…. ¿Tienes disponible algún screener para ondas de wolfe? Haces un trabajo increíble!!!! Gracias!!!
Hola Nicolas, por si acaso tienes el código de la funccion ‘ ZIgZAG’ ? O… sabrias como desarrollar solamente esta funccion? Muchas Gracias!!!
Esta función es interna y no puede reproducirse con el mismo comportamiento por código (repita en tiempo real la última parte superior o inferior).
Los indicadores de fractales también son un buen enfoque para encontrar las partes superiores e inferiores, hay muchos indicadores basados en ellos en la biblioteca.
Would there be a way to derive these support/resistance figures for automatic trading?
That’s not possible because the code uses ZigZag instruction from the platform which is not reliable for automatic trading (and not allowed by the system).
Thanks Nicolas. Do you have any idea of how I could generate support/resistance figures for automatic trading?
Try fractals, swing high/low points, donchian channel, ..
Thank you for this indicator Nicolas, very useful for Range detection.
Hi @Nicolas , I tried importing the ITF files and even directly copying the above indicator into my PRT and it came up blank both times. Is there something I’m missing?
Try to modify the settings? The percentage of zigzag might be too large?
Sorry for the late response. I gave up using it. Tried modifying the settings but it still came up at the bottom of the chart blank. It’s also comes up different from the photo above where it creates a different space for the indicator rather than show on the price as above.
If you add it on the price chart (by using the wrench on the left upper side of the price chart), then it should comes up on the main chart 🙂
Thanks. On point. 🙂
Modifs:
ajout du prix
A faire tourner en 1 heure 50 unités dans tout petite fenêtre.
Alors merci au créateur.
//PRC_ZigZag SupDem | indicator
//13.03.2019
//Nicolas @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
defparam drawonlastbaronly=true
defparam calculateonlastbars=1000
// — settings
//ecartmini = 3 //zigzag ecartmini
//lookback = 100 //max history lookback
//eliminanciens = 1 //price ecartmini between 2 ZZ points
//minPoint = 2 //minimal points to confirm S/R
//showSupport = 1 //plot support zones or not? (0=false;1=true)
//showResistance = 1 //plot resistance zones or not? (0=false;1=true)
// — end of settings
//zz s/r
zz = ZigZag[ecartmini](customclose)
p = zzzz[2]
t = zz>zz[1] and zz[1]<zz[2]
if p then
top = zz[1]
endif
if t then
bottom = zz[1]
endif
once minPoint = max(2,minPoint)
for i = 1 to lookback do
if showResistance then
//new peak
if p[i] then
topdata = top[i]
hhtop = topdata+(customclose[i]*(eliminanciens/100))
lltop = topdata-(customclose[i]*(eliminanciens/100))
resttest=0
for y = i to lookback do
resttest = resttest + (top[y]lltop)
if resttest>=minPoint then
//drawarrowdown(barindex[i],topdata) coloured(255,0,0)
drawsegment(barindex[lookback],topdata,barindex[1],topdata) coloured(255,0,0)
DRAWTEXT(“#topdata#”,barindex+5,topdata,SansSerif,Bold,14)coloured(153,153,0)
break
endif
next
endif
endif
if showSupport then
//new through
if t[i] then
data = bottom[i]
hh = data+(customclose[i]*(eliminanciens/100))
ll = data-(customclose[i]*(eliminanciens/100))
suptest=0
for y = i to lookback do
suptest = suptest + (bottom[y]ll)
if suptest>=minPoint then
//drawarrowup(barindex[i],data) coloured(0,255,0)
drawsegment(barindex[lookback],data,barindex[1],data) coloured(0,255,0)
DRAWTEXT(“#data#”,barindex+5,data,SansSerif,Bold,14)coloured(153,153,0)
break
endif
next
endif
endif
next
hprice = highest[lookback](customclose)
lprice = lowest[lookback](customclose)
drawsegment(barindex[lookback],hprice,barindex,hprice)
DRAWTEXT(“#hprice#”,barindex+5,hprice,SansSerif,Bold,16)coloured(153,153,153)
drawsegment(barindex[lookback],lprice,barindex,lprice)
DRAWTEXT(“#lprice#”,barindex+5,lprice,SansSerif,Bold,16)coloured(153,153,153)
prix = Close
return prix as “supports et résistances” //coloured(153,153,0)
//
How do I change the thickness of the line or change it too dashed lines? Kind regards
NE fonctionne pas ( ou plus … )
il faut modifier toutes les références à top par itop et bottom par ibottom. Ces mots étant désormais réservés à des instructions, dut à l’évolution du langage.
En théorie en téléchargeant le fichier itf attaché et en l’important la modification se fait d’elle même.