Nicolas

Bill Williams Fractals

Category: Indicators By: Nicolas Created: May 24, 2016, 8:21 AM
May 24, 2016, 8:21 AM
Indicators
61 Comments
Bill Williams Fractals

“In order for a fractal to form, there should be a series of 5 consecutive bars where the middle bar will be the highest preceded and followed by two lower neighbouring bars on each side.”

Since this indicator is frequently requested on forums, I put the code here (author: SOHOCOOL).

Fractals can be used in many different approach:

  • Market points reversal
  • Breakout of recent fractals points
  • Trend line drawn from recent fractals

The “Low Fractal” and “High Fractal” may be set to ‘points’ style in the platform to have a clearer view of them on the price chart. 

 

/////////// FRACTALS BILL WILLIAMS
//Variable:

//cp = 2 (default)  

if high[cp] >= highest[2*cp+1](high) then
 LH = 1
else
 LH=0
endif

if low[cp] <= lowest[2*cp+1](low)  then
 LL= -1
else
 LL=0
endif

if LH=1 then
 hil = high[cp]
endif

if LL  = -1 then
 LOL=low[cp]
endif


return lol coloured(255,0,0) as "Low Fractal",hil coloured(0,255,0) as "High Fractal"

/////////////end

 

Download
Filename: Fractals-Bill-Williams.itf
Downloads: 1674
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

withoutwings
4 years ago
#

Hi All, I've made some fixes & upgrades so that this single script can either used as an overlay, as a separate indicator panel, or even as a "function" to provide a basic signal (up/down only) for use in automated trading: // Required variables (default) [description]: // - N (2) [Real-time delay / bars to look both back and forward] bwfSig = 0 r = 255 g = 255 b = 255 IF (High[N] >= Highest[2*N+1](High)) AND (High[N] > Highest[N](High)) THEN bwfSig = -1 ELSIF (Low[N] <= Lowest[2*N+1](Low)) AND (Low[N] < Lowest[N](Low)) THEN bwfSig = 1 ENDIF IF bwfSig = -1 THEN DRAWARROWDOWN(barindex[N], high[N] + Averagetruerange[100]/3) Coloured(255,10,10) r = 204 g = 0 b = 0 ELSIF bwfSig = 1 THEN DRAWARROWUP(barindex[N], low[N] - Averagetruerange[100]/3) Coloured(0,255,0) r = 0 g = 153 b = 0 ENDIF RETURN bwfSig Coloured (r,g,b) Style(Histogram, 1) Again, this does not return the actual levels but that would be trivial to add in as a future upgrade. Also note that each signal will arrive 'N' periods late - but that is the nature of the beast! Enjoy.

Traderfox06
8 years ago
#

Dear Nicolas, all the best for 2019 and thanks for this contribution. I love this indicator, because it combines both powerful Regression and Williams Fractals concepts. Since I am not skilled enough to convert this into an automated scalping system, I really would appreciate if you could give an advice how to code the long/short signals here (see question above from „verygrubby“). At least it would be very helpful to me, to know how I can generate an acoustic signal (just a „beep“) in addition to the point plotting. I know, how to create alerts (https://www.prorealtime.com/en/videos_tutorial/135_create_alerts) but code-generated alerts would be much more flexible. Thanks a lot in advance!

rollersk8er
8 years ago
#

Hi Nicolas, I am trying to change this indicator to work with 3 candles instead of 5 but cannot get it to work properly when changing the CP. Any suggestions please? Regards Patric

Nicolas
8 years ago
#

Je vous suggère de faire une recherche sur le site avec le mot clé 'fractals', il existe beaucoup de versions différentes, peut-être que l'une d'entre elles vous apportera satisfaction.

jtmoney
9 years ago
#

Hi, great indicator. However, when I put it on as an indicator it doesn't show up the chart but rather a new indicator tab below. Sorry if this is basic, I'm quite new. Any thoughts? Thanks very much!

Nicolas
9 years ago
#

add it on price by using the wrench at the upper left side of the price chart.

Diego Alonso Garrido
9 years ago
#

How its possible to change the number of candles needed for the fractal formed??? Thanks

Nicolas
9 years ago
#

Yes, change the quantity with the Cp variable at the beginning of the code.

crolakstrading
9 years ago
#

oops sorry.. i manage to get that out!! thanks!!

crolakstrading
9 years ago
#

Hi Nicolas, is it possible to make this into the black background?? as when you put this into the black background on PRT.. it shows a white colour in between the green and red lines?

adayag
9 years ago
#

I would like to have the same Indicator showed at the beginning of this page. It would be comprehensible for me with the same settings that are in the Image, otherwise I don’t know to read it

adayag
9 years ago
#

Hi Nicolas, thank you for your answer. I clicked on the wrench but after that I don't know where to remove the color zone. I have also asked my broker.

Nicolas
9 years ago
#

To remove the color zone, just delete it in the indicator settings.

adayag
9 years ago
#

You can find the screenshot at the following link: https://ibb.co/gfvPkR I hope it helps

Nicolas
9 years ago
#

Please add it on your price chart instead (click on the wrench on the left upper side of your price chart) and remove the color zone.

adayag
9 years ago
#

Hi Nicolas, thank you for your answer. Nothing has been changed after having applied your instructions. The indicator that I have is completely different from what is expected to be. How can I send you a screenshot?

adayag
9 years ago
#

I deleted the //, but it gives a further error on line 4

Nicolas
9 years ago
#

Please download the file and import it.

adayag
9 years ago
#

Thank you. I could upload it on the Pro Real Time platform, but it is not the same indicator in the Image. It shows a green segmented line above, a red segmented line below and a Grey area between them. I need an indicator for the poitioning of a continuously moving stop loss (like a trailng stop). Here it is better explaied: https://www.dailyfx.com/forex/education/trading_tips/daily_trading_lesson/2014/05/09/The-More-Intelligent-Trailing-Stop.htmlhttps://www.dailyfx.com/forex/education/trading_tips/daily_trading_lesson/2014/05/09/The-More-Intelligent-Trailing-Stop.html

Nicolas
9 years ago
#

You only need to set these lines to points in the indicator settings.

adayag
9 years ago
#

Hi, I was looking for an asymmetrical fractal to be set on Pro Real Time and I have found the code on this page. Unfortunately it gives a syntax error: define the variable cp

Nicolas
9 years ago
#

Yes define it. Uncomment the cp variable (delete the //) or just download the itf file and import it directly into the platform to get this setting available in the indicator's window.

mcha
9 years ago
#

Merci Nicolas, j'ai pris l'option points ce qui fait des quasi segment sur des UT courtes ( jour) mais en hebdo c'est plus light, est-ce possible d'avoir un segment continu (l'option proposée par PRT ligne + points génère des lignes reliant les fractales ce qui alourdit le graphe). Merci par avance

Real Pro
9 years ago
#

Yes 10.3, IG Markets.

Real Pro
9 years ago
#

Thanks Nicolas. Same response. It gives an error for the word 'if'.

Nicolas
9 years ago
#

Do you have version 10.3? What broker?

Real Pro
9 years ago
#

Why do I get this error when I try to add the arrows please? "One of the following characters would be more suitable than "if"?"

Nicolas
9 years ago
#

Try the code from this comment: https://www.prorealcode.com/prorealtime-indicators/bill-williams-fractals/#comment-1000

ProRealCode ProRealCode
Loading...