This indicator is designed to analyze price action trends by calculating and visualizing the momentum and directional shifts of the market. Instead of simply looking at where the price is now, it evaluates how "aggressive" or "smooth" the price movement has been over a specific period.
Core Logic & Data Processing
The script operates by first establishing a baseline for every candle. It takes the average of the High, Low, Open, and Close prices to determine a central price point. From there, it calculates a rolling average across a user-defined window (defaulting to 8 periods) to identify the general "path" the market is taking.
The intelligence of the script lies in how it compares different types of averages:
- Current Momentum: It looks at the immediate price behavior.
- Delayed Momentum: It analyzes the average behavior of the preceding period.
- Comparison Engine: By comparing these two values, the tool calculates the "velocity" and "acceleration" of the price movement.
Visual Interpretation & Signal Logic
The indicator translates these complex mathematical comparisons into a visual histogram in a separate window. It breaks down the market sentiment into several distinct components:
- Velocity (Difference): This tracks the raw difference between current price averages and previous ones. It helps identify if the trend is expanding or contracting.
- Trend Consistency: The script calculates a "mean" of these differences to smooth out market noise, helping users see the underlying trend more clearly.
- Directional Strength: The logic applies specific filters to highlight significant movements:
- It identifies whether the price is moving upward or downward based on a specific "force" threshold.
- When certain conditions are met (such as a positive move combined with high consistency), it highlights specific segments of the histogram.
Summary for Traders
Essentially, this tool acts as a "momentum speedometer." Rather than just telling you if the price is up or down, it tells you how much power is behind that movement. By visualizing the difference between current price velocity and previous trends, it helps traders identify:
- Trend Strength: Is the move gaining speed or slowing down?
- Momentum Shifts: Is the market beginning to lose its "push" before a reversal happens?
- Volatility Filtering: It separates random price fluctuations from sustained, meaningful directional trends.
//---------------------SVS_Trend------
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 White
#property indicator_color2 DarkGray
#property indicator_color3 Black
#property indicator_color4 MediumBlue
#property indicator_color5 FireBrick
#property indicator_color6 DarkGreen
extern int p1=8;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//--------------------------------------
int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexStyle(5,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(5,ExtMapBuffer6);
return;
}
//---------------------------------------------------------
double hloc(int i,int p)
{
double hloc;
hloc=0;
for(int n=i;n<=i+p-1;n++)
{
hloc=hloc + ((High[n]+Low[n]+Open[n]+Close[n])/4);
}
return(hloc/p);
}
//------------------------------------------
int start()
{
double z,s1,v1,vts,vv,sv,svz,vj,vk,vd,ff;
//-----------------------------------
int i,Counted_bars;
Counted_bars=IndicatorCounted();
i=Bars-Counted_bars-1;
while(i>=0)
{
vts=0;
z=(High[i]+Low[i]+Open[i]+Close[i])/4;
s1=hloc(i,p1);
for (int c=i;c<=(i+p1-1);c++){
vts=vts+hloc(c,p1);
if(c==(i+p1-1))v1=vts/p1;
}
//---------------------------------
sv=(s1+v1)/2;
svz=(sv+z)/2;
ff=(svz-sv);
vv=(s1-v1);
vk=(vv+ff)/2;
vd=(ff/2);
vj=(vv-vd);
//----------------------------
ExtMapBuffer1[i]=vv;
ExtMapBuffer2[i]=vk;
ExtMapBuffer3[i]=vd;
if (vd>0) ExtMapBuffer4[i]=vj;
if (vd<0) ExtMapBuffer5[i]=vj;
if (vd>0 && vk<vj) ExtMapBuffer6[i]=vj;
if (vd<0 && vk>vj) ExtMapBuffer6[i]=vj;
i--;
}
return;
}
//--------------------------------------------------------------------
Comments