Ind-SKB-1_v2
Download scriptThis technical indicator is designed to analyze price action by identifying specific geometric structures in historical market data. Its primary objective is to detect significant shifts in market direction and project potential "zones" or trend lines based on the relationship between high and low price points.
Core Logic Overview
The script operates by scanning past price candles to locate Fractals. In trading, fractals represent local peaks (highs) and valleys (lows). Rather than simply marking these points, the logic evaluates how these highs and lows interact with one another over time to establish a structural trend.
Key Functional Steps
- Pattern Identification: The script looks backward through the price history to find distinct upward and downward turns. It specifically isolates these peaks and valleys to understand the "skeleton" of the market movement.
- Comparative Analysis: Once the script identifies a high or low point, it doesn't view it in isolation. It compares subsequent price points to determine if the market is making higher highs, lower lows, or if it is consolidating.
- Trend Projection: The logic uses these identified points to calculate linear trajectories. By measuring the distance and angle between two significant peaks (or two significant valleys), the tool mathematically predicts where the current trend line should logically sit on the chart.
- Dynamic Mapping: Based on these calculations, the script draws lines that represent the "equilibrium" of the price action. These lines serve as visual guides to help traders see the underlying structure of the market, moving from one significant point of interest to the next.
Visual Output
The indicator translates this complex mathematical scanning into three primary types of visual data:
- Trend Lines: Continuous lines that track the projected path of the market's movement.
- Structural Markers: Distinct points (arrows) that highlight where the script has confirmed a specific structural turn or breakout.
- Price Boundaries: The logic specifically differentiates between "Upper" and "Lower" boundaries, providing a clear visual of the range in which the price is currently oscillating.
In summary, this tool acts as a structural map for the chart. It filters out the "noise" of minor price fluctuations to show you the larger path the market is following by connecting the dots between significant historical highs and lows.
//+------------------------------------------------------------------+
//| Ind-SKB-1.mq4 |
//| Copyright © 2005, Kara Software Corp. |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Kara Software Corp."
#property link ""
//----
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_color5 FireBrick
#property indicator_color6 FireBrick
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_ARROW);
SetIndexArrow(4,217);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexEmptyValue(4,0.0);
SetIndexStyle(5,DRAW_ARROW);
SetIndexArrow(5,218);
SetIndexBuffer(5,ExtMapBuffer6);
SetIndexEmptyValue(5,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double FU,FL;
int CCU1,CCU2,CCL1,CCL2,shift,i,j;
//----
CCU1=0;CCU2=0;CCL1=0;CCL2=0;
for(shift=Bars-100;shift>=0;shift--)
{
FU=0;FL=0;
FU=iFractals(NULL,0,MODE_UPPER,shift+3);
FL=iFractals(NULL,0,MODE_LOWER,shift+3);
if(FU>0)
{
i=shift+3+1;
while(iFractals(NULL,0,MODE_UPPER,i)==0)i++;
for(j=shift+3;j<=i;j++)
{
if(iFractals(NULL,0,MODE_LOWER,j)>0)
{
CCU1=shift+3;
CCU2=i;
if(CCL1==0)CCL1=j;
else
if(Low[j]<Low[CCL1])CCL1=j;
CCL2=0;
}
}
if(j==i && High[i]>High[shift+3])FU=0;
}
if(FL>0)
{
i=shift+3+1;
while(iFractals(NULL,0,MODE_LOWER,i)==0)i++;
for(j=shift+3;j<=i;j++)
{
if(iFractals(NULL,0,MODE_UPPER,j)>0)
{
if(CCU1==0)CCU1=j;
else
if(High[j]>High[CCU1])CCU1=j;
CCU2=0;
CCL1=shift+3;
CCL2=i;
}
}
}
if(CCU1>0 && CCU2>0)
{
if(High[CCU1]>High[CCU2])
{
ExtMapBuffer1[shift]=High[CCU1]+(High[CCU1]-High[CCU2])/(CCU2-CCU1)*(CCU1-shift);
ExtMapBuffer2[shift]=Low[CCL1]+(High[CCU1]-High[CCU2])/(CCU2-CCU1)*(CCL1-shift);
}
if(High[CCU1]<High[CCU2])
{
ExtMapBuffer1[shift]=High[CCU1]-(High[CCU2]-High[CCU1])/(CCU2-CCU1)*(CCU1-shift);
ExtMapBuffer2[shift]=Low[CCL1]-(High[CCU2]-High[CCU1])/(CCU2-CCU1)*(CCL1-shift);
}
}
if(CCL1>0 && CCL2>0)
{
if(Low[CCL1]<Low[CCL2])
{
ExtMapBuffer1[shift]=High[CCU1]-(Low[CCL2]-Low[CCL1])/(CCL2-CCL1)*(CCU1-shift);
ExtMapBuffer2[shift]=Low[CCL1]-(Low[CCL2]-Low[CCL1])/(CCL2-CCL1)*(CCL1-shift);
}
if(Low[CCL1]>Low[CCL2])
{
ExtMapBuffer1[shift]=High[CCU1]+(Low[CCL1]-Low[CCL2])/(CCL2-CCL1)*(CCU1-shift);
ExtMapBuffer2[shift]=Low[CCL1]+(Low[CCL1]-Low[CCL2])/(CCL2-CCL1)*(CCL1-shift);
}
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments