Fractal Breakout

First of all, huge credit to synapticEx, whose brilliant use of the security function inspired me to figure out a way to get quasi-shape boundaries automatically drawn on a chart.

This study draws upper and lower trend lines , based on configurable fractal*** reversal detection, calculates slope from the last two upper or lower reversal points, and then extends a dotted line along the same slope...until the next upper (or lower) reversal occurs. If the high (or low) breaks this extension, the dotted line becomes solid to aid visibility. Reversal detection is configurable to use any number of ticks, but probably four to eight will work best.

I made the inclusion of volume in the reversal logic optional (off by default) and left the existing SMA input found in synapticEx's code intact, albeit with a lower default. With the addition of trend lines , I found volume hindered identification of reversals, although I could try various other filters than the SMA included originally.

I have also left intact the very nice ability to change the period and use the requested period identify reversals, courtesy of synapticEx.

This could be used in a strategy, as the values plotted are actual values that are available to include in logic and do not include knowledge of the future. However, information is not available until the floor of half the number of ticks used in reversal detection (I then offset by that number to line things up visually). Having never heard of it until now, I just Googled the Bill Williams Alligator strategy, which looks interesting, so maybe I could see how this could be ported to that.

***As I typed this, I remembered that while making reversal detection configurable, I changed the detection logic simply to look for highest (or lowest) of the desired length of ticks. I don't know whether this is not strictly fractal anymore, but if desired, with a little work, I could make it require consecutive, consistent changes before and after each reversal again.

Here are a few screenshots from hourly ticks, using the "current" (hourly) period, with and without volume , and playing with the number of points used to identify reversals.

Not using volume

Using volume
Skrip open-source

Sejalan dengan semangat TradingView, penulis skrip ini telah mempublikasikannya secara open-source, sehingga para trader dapat memahami dan memverifikasinya. Salut untuk sang penulis! Anda dapat menggunakannya secara gratis, tetapi penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk dapat menggunakannya didalam sebuah chart.

Inggin menggunakan skrip ini pada chart?


Hello, very good script man! Thank you I propose a modification to you, or ask for your help to do it myself. Only draw lines if the last 2 fractals are opposite. If the last 2 fractals are in the same direction, don't draw lines. I am trying to write a code with the Stpatterns strategy
V1 left available because it still has the "change resolution" feature enabled, but in general I think V2 is better:
I have added a pretty cool trend line because it was easy, and I can update this published indicator if I figure out how to revise the code....

Hello Lemrin, this is a interesting script, I am still figure how to use it properly. Appreciated your efforts and generous shared this to public =D
Lemrin ICEKI
@ICEKI, Thank you, I'm glad you like it! As I am still learning to use Pine script (never heard of it until I joined a few days ago), I basically just attempted to do this because I wanted to see what is possible.

With that said, though, I think highs above the top trend extension (green circles that get darker when high is above them) or lows below the bottom trend extension (red circles that get darker when low is below them) could indicate a possible breakout, which of course you may want to verify using other indicators.

Technical note for use in strategies...
potential buy condition would probably include something like this: high>topsExtension
and potential sell: low<bottomsExtension

I added something like that to my first strategy I published (again, this is all "hello_world" level for me right now, since I'm learning), and it improved it on most charts.
Lemrin Lemrin
@Lemrin, Oops sorry, it seems my square brackets were filtered out of my reply. In that technical note, the high and low values being compared are offset (square brackets) by "offset_len"
So it's high(offset_len)>topsExtension but with square brackets instead of parentheses.
ICEKI Lemrin
@Lemrin, Thanks for your detail explanation =D
Beranda Penyaring Saham Penyaring Forex Penyaring Crypto Kalender Ekonomi Tentang Fitur-Fitur Chart Harga Akun Refer seorang teman Tata Tertib Pusat Bantuan Solusi Website & Broker Widget-Widget Solusi Charting Perpustakaan Charting Ringan Blog & Berita Twitter