This indicator represents the last levels of fractals with boxes allowing to trade the breakouts of these zones of supports and resistances.
Boxes are created on the fly at each new bar. The indicator using loops being prone to heavy calculation, I suggest you use only a relatively weak lookback period (parameter to be changed in the indicator window).
It is possible to modify the transparency of boxes using the variable “alpha”, located at 100 by default (maximum = 255).The boxes can be of different colors by adjusting the MaxPipsBox setting highlighting red boxes larger than MaxBoxPips.
The indicator has been converted from a Metatrader4 version following a request from someone in the corresponding forum.
//PRC_FractalsBox | indicator
//08.02.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
defparam drawonlastbaronly=true
// --- settings
LookBackBars = 100
MaxPipsBox = 0
MaxBoxPips = 15
alpha = 100
// --- end of settings
//fractals
cp = 2
if high[cp] >= highest[2*cp+1](high) then
hil = high[cp]
else
hil=0
endif
if low[cp] <= lowest[2*cp+1](low) then
lol=low[cp]
else
lol=0
endif
if barindex>LookBackBars then
for li28 = LookBackBars downto 0 do
if(hil[li28]<>0) then
price4=hil[li28]
endif
if(lol[li28]<>0) then
price12=lol[li28]
endif
if(MaxPipsBox and price4-price12>MaxBoxPips*pipsize) then
r=240
g=0
b=0
else
r=100
g=100
b=100
endif
drawrectangle(barindex[li28+cp],price4,barindex[li28+cp+1],price12) coloured(r,g,b,alpha)
next
drawrectangle(barindex[0],price4,barindex[li28+cp+1],price12) coloured(r,g,b,alpha)
endif
return
You must be logged in to post a comment.
Bonjour Merci pour ce code il m'apporte beaucoup par contre est il possible que tu réalises une version qui remplace les boites par des segments? Merci d'avance, un fidèle de tes codes!!! Matthieu
Thanks for this good indicator Nicolas. I would like to make the upper and lower limits more visible on the graph, and I change the last line "return" to "return price4, price12", but unfortunately it draws both prices 2 bars later. Is there any way to draw both prices on the same bar than the rectangles?