Fractal-Channel
Download scriptThe Fractal Channel indicator is designed to provide traders with a visual representation of market structure by identifying and connecting key price turning points. Instead of cluttering the chart with every minor price fluctuation, this tool focuses on significant "fractals"—peaks and valleys that represent potential shifts in momentum.
How the Logic Works
The script operates by scanning your price history to identify two specific types of structural points: Upper Fractals (local highs) and Lower Fractals (local lows). Here is a breakdown of how it processes this data:
1. Identification of Turning Points The tool automatically hunts for the most recent significant high and low points on the chart. It looks backward through the price bars to find these "fractals," which are used to determine where the market has reached a temporary peak or bottom.
2. Connection and Trend Mapping Once it finds these turning points, the script draws trend lines to connect them:
- Resistance Channels (Highs): It identifies the most recent upper fractals and connects them with red trend lines. This helps you visualize the "ceiling" of the current price movement.
- Support Channels (Lows): It identifies the most recent lower fractals and connects them with blue trend lines. This helps you visualize the "floor" or base of the price movement.
3. Dynamic Updates The indicator is designed to be reactive. As new price data comes in and new fractals are formed, the script automatically moves the endpoints of the existing lines. This ensures that the channels stay updated with the most current market activity without needing to be redrawn manually.
4. Customization and Range You can control how many historical connections the indicator displays. By adjusting the count setting, you can choose whether to see a short-term view of the most recent trend lines or a more expansive, long-term history of price highs and lows.
Summary for Traders
By highlighting these structural "channels," the tool helps you quickly see where the market is finding resistance and support. It strips away the noise of daily volatility, allowing you to focus on the broader flow of the market—making it easier to spot potential breakout zones or trend reversals.
//+--------------------------------------------------------------------------------------+
// F R A C T A L C H A N N E L |
// Copyright © RickD BJF Trading Group 2006 |
// http://fxstrategy.ca |
// |
//Experts http://fxstrategy.ca/experts.php SALE! 50% OFF |
//Indicators http://fxstrategy.ca/products.php SALE!50% OFF |
//Digital Filters Strategy http://fxstrategy.ca/digital_filtrs.php SALE!50% OFF |
//Trading Signals http://fxstrategy.ca/signals.php Two weeks FREE! No CC. |
// forex calendar, research, article .... |
//+--------------------------------------------------------------------------------------+
#property copyright "© RickD BJF Trading Group 2006"
#property link "http://fxstrategy.ca/products.php"
#property indicator_chart_window
#property indicator_buffers 0
extern int cnt = 20;
extern color HHTL_color =C'255,25,25';
extern color LLTL_color =C'45,45,255';
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void init() {
clear();
show();
}
void deinit() {
clear();
}
void start()
{
show();
}
void show() {
string name = "";
double fr1, fr2;
int bar1, bar2;
int i = 2;
for (int j=0; j < cnt; j++) {
for (; i < Bars; i++) {
fr1 = iFractals(NULL, 0, MODE_UPPER, i);
if (fr1 > 0) {
bar1 = i;
break;
}
}
for (i=i+2; i < Bars; i++) {
fr2 = iFractals(NULL, 0, MODE_UPPER, i);
if (fr2 > 0) {
bar2 = i;
break;
}
}
name ="R" + j;
if (ObjectFind(name) == -1) {
ObjectCreate(name, OBJ_TREND, 0, Time[bar2], fr2, Time[bar1], fr1);
ObjectSet(name, OBJPROP_COLOR, HHTL_color);
ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(name, OBJPROP_WIDTH, 0);
ObjectSet(name, OBJPROP_RAY, j==0);
}
else
{
ObjectMove(name, 0, Time[bar2], fr2);
ObjectMove(name, 1, Time[bar1], fr1);
}
}
i = 2;
for (j=0; j < cnt; j++) {
for (; i < Bars; i++) {
fr1 = iFractals(NULL, 0, MODE_LOWER, i);
if (fr1 > 0) {
bar1 = i;
break;
}
}
for (i=i+2; i < Bars; i++) {
fr2 = iFractals(NULL, 0, MODE_LOWER, i);
if (fr2 > 0) {
bar2 = i;
break;
}
}
name ="S" + j;
if (ObjectFind(name) == -1) {
ObjectCreate(name, OBJ_TREND, 0, Time[bar2], fr2, Time[bar1], fr1);
ObjectSet(name, OBJPROP_COLOR, LLTL_color);
ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(name, OBJPROP_WIDTH, 0);
ObjectSet(name, OBJPROP_RAY, j==0);
}
else
{
ObjectMove(name, 0, Time[bar2], fr2);
ObjectMove(name, 1, Time[bar1], fr1);
}
}
}
void clear()
{
string name = "";
int res = -1;
for (int j=0; j < cnt; j++) {
name = "R" + j;
if (ObjectFind(name) != -1) ObjectDelete(name);
name = "S" + j;
if (ObjectFind(name) != -1) ObjectDelete(name);
}
}
Comments