dex_SRFractal
Download scriptThis technical indicator is designed to help traders visualize key market structure levels, specifically focusing on identifying areas of price consolidation and potential profit targets based on historical price action.
Core Logic Overview
The tool operates by scanning historical price data to identify significant "peaks" and "valleys" in the market. It uses a specific geometric logic to calculate three primary components: Resistance, Support, and a central Pivot Point.
How the Tool Works:
-
Identifying Highs and Lows (Fractals): The script constantly monitors the price movement to find "Fractals." These are essentially local high points (Resistance) and local low points (Support). Instead of showing every minor wiggle in the market, it focuses on these significant structural extremes.
-
The Pivot Point Calculation: Once a clear Resistance level and Support level are identified, the tool calculates a "Pivot" line. This is mathematically determined as the exact midpoint between the identified high and low. This represents the equilibrium of that specific price range.
-
Dynamic Profit Targets: One of the unique features of this logic is how it handles profit targets. It measures the distance (the "channel width") between the Resistance and Support lines. It then takes one-third of that distance and projects it above and below the Pivot Point.
- Profit Buy: This is the calculated target for a long position, based on the midpoint plus one-third of the range.
- Profit Sell: This is the calculated target for a short position, based on the midpoint minus one-third of the range.
-
The Minimum Channel Filter: To ensure the tool doesn't provide "noisy" or unrealistic data during very flat market conditions, it includes a minimum channel requirement. The logic only calculates and displays these levels if the distance between the high and low is large enough to be considered a significant trading range.
Visual Presentation
The indicator provides clear visual cues on your chart:
- Resistance & Support: Marked with distinct dots to show you where price has historically turned around.
- Pivot Line: A solid line showing the current "balance" of the market range.
- Profit Targets: Dashed lines that project potential exit points for both buying and selling opportunities based on the calculated geometry of the current range.
- Data Overlay: For live trading (non-testing mode), the script provides a real-time text summary on your screen, displaying the exact price levels and the number of "points" available for profit in both directions.
#property copyright "akadex"
#property link "tohell"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 White
#property indicator_color4 Aqua
#property indicator_color5 Red
extern double mincanal=0.0020;
//---- buffers
double v1[];
double v2[];
double v3[];
double v4[];
double v5[];
double val1,val2,h,l,profit;
int i,profitpointsell,profitpointbuy;
int deinit() {Comment ("");}
int init()
{
IndicatorBuffers(5);
SetIndexArrow(0, 119);
SetIndexArrow(1, 119);
SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,0,Red);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0,"Resistance");
SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,0,Blue);
SetIndexDrawBegin(1,i-1);
SetIndexBuffer(1, v2);
SetIndexLabel(1,"Support");
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
SetIndexDrawBegin(2,i);
SetIndexBuffer(2, v3);
SetIndexLabel(2,"Pivot");
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_LINE,STYLE_DASH,1);
SetIndexDrawBegin(3,i);
SetIndexBuffer(3, v4);
SetIndexLabel(3,"Profit Buy");
SetIndexEmptyValue(3,0.0);
SetIndexStyle(4,DRAW_LINE,STYLE_DASH,1);
SetIndexDrawBegin(4,i);
SetIndexBuffer(4, v5);
SetIndexLabel(4,"Profit Sell");
SetIndexEmptyValue(4,0.0);
return(0);
}
int start()
{
i=Bars;
while(i>=0)
{
val1 = iFractals(NULL, 0, MODE_UPPER,i);
if (val1 > 0)
v1[i]=High[i];
else
v1[i] = v1[i+1];
val2 = iFractals(NULL, 0, MODE_LOWER,i);
if (val2 > 0)
v2[i]=Low[i];
else
v2[i] = v2[i+1];
if ((v1[i]-v2[i])>=mincanal){
v3[i]=(v1[i]+v2[i])/2;
profit=(v1[i]-v2[i])/3;
v4[i]=v3[i]+profit;
v5[i]=v3[i]-profit;
profitpointbuy=(v4[i]-v3[i])/Point;
profitpointsell=-(v5[i]-v3[i])/Point;
}
if (!IsTesting()) {Comment ("Ìèíèìàëüíûé êàíàë: ",mincanal," ïóíêòîâ\n",
"Óðîâåíü ñîïðîòèâëåíèÿ: ",v1[i],"\n",
"Óðîâåíü ïîääåðæêè: ",v2[i],"\n",
"Óðîâåíü Pivot: ",v3[i],"\n",
"Ïðîôèòíîñòü íà Buy: ",profitpointbuy," ïóíêòîâ.\n",
"Ïðîôèòíîñòü íà Sell: ",profitpointsell," ïóíêòîâ.\n");}
i--;
}
return(0);
}
Comments