Nicolas

Fractals Box

Category: Indicators By: Nicolas Created: February 8, 2018, 4:24 PM
February 8, 2018, 4:24 PM
Indicators
8 Comments
Fractals Box

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

 

Download
Filename: PRC_FractalsBox.itf
Downloads: 398
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Pere
8 years ago
#

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?

Nicolas
8 years ago
#

because fractals are known 2 bars later! that's why I used rectangle to plot them in the past.

matthieuatd
8 years ago
#

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

Nicolas
8 years ago
#

Merci, faire une demande dans le forum approprié.

Real Pro
9 years ago
#

Hi Nicolas, I'm having trouble changing the colours according to the instructions you gave. Could you explain please?

Nicolas
9 years ago
#

https://www.prorealcode.com/topic/mt4-fractal-box/

juanj
9 years ago
#

Kinda reminds me of Renko Trading

swapping
9 years ago
#

Toujours aussi prolifique Nicolas ;) Ce sera donc du Darvas à la sauce Forex, excellent je prends ...

ProRealCode ProRealCode
Loading...