prusax_v61
Download scriptThis custom indicator is designed to provide a visual representation of price action by highlighting the specific boundaries of market movement on your trading chart. Rather than cluttering the screen with complex lines, it uses a histogram-style display to distinguish between bullish (upward) and bearish (downward) price trends based on the individual behavior of each candle.
Core Logic and Behavior
The script analyzes the relationship between four key price points: the High, Low, Open, and Close of every price bar. It categorizes the market movement into two distinct states:
- Bullish Movement (Upward Trend): When a candle closes higher than it opened, the script identifies this as upward momentum. It focuses on capturing the peak height (the High) and the starting point (the Open) of that specific move.
- Bearish Movement (Downward Trend): When a candle closes lower than it opened, the script recognizes downward pressure. In these instances, it shifts its focus to capture the starting point (the Open) and the bottom limit (the Low) of the price drop.
Visual Interpretation
The indicator translates these mathematical calculations into four distinct visual buffers on your chart:
- Upper Range Markers: These highlight the maximum reach of the price during bullish phases, helping you identify where the "ceiling" of a move occurred.
- Lower Range Markers: These identify the "floor" or the deepest point reached during bearish phases.
- Dynamic Positioning: For every candle that moves in one direction, the script effectively "mutes" the opposite side (setting those values to zero). This ensures that you only see relevant data for the current trend—showing you the peaks of the rallies and the depths of the sell-offs without unnecessary visual noise.
Summary for Traders
Essentially, this tool acts as a filter that separates price action into "success zones." It ignores the noise of neutral movement to highlight the extremes of the market. By visualizing these specific high and low points based on the candle's direction, it allows you to see the structural boundaries of price trends more clearly, making it easier to identify where strength is being tested or where momentum is fading.
//+------------------------------------------------------------------+
//| prusax_v2.mq4
//| 2008 modified by zIG
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
//---- buffers
double BufferUP[];
double BufferDN[];
double BufferUP1[];
double BufferDN1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
IndicatorBuffers(4);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,BufferUP);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,BufferUP1);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(2,BufferDN);
SetIndexStyle(3,DRAW_HISTOGRAM);
SetIndexBuffer(3,BufferDN1);
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
//----
return(0);
}
//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
for(i=Bars-counted_bars-1;i>=0;i--)
{
if(i==0)
{
BufferUP[i] = High[i];
BufferUP1[i] = (High[i]-(((High[i]-Open[i])+(Close[i]-Low[i]))/2));
BufferDN[i] = (High[i]-(((High[i]-Open[i])+(Close[i]-Low[i]))/2));
BufferDN1[i] = (High[i]-(((High[i]-Open[i])+(Close[i]-Low[i]))/2))-(((Open[i]-Low[i])+(High[i]-Close[i]))/2);
}
else
{
if(Close[i]>Open[i])
{
BufferUP[i] = High[i];
BufferUP1[i] = Open[i];
BufferDN[i] =0.0;
BufferDN1[i] =0.0;
}
else
if(Close[i]<Open[i])
{
BufferUP[i] = 0.0;
BufferUP1[i] = 0.0;
BufferDN[i] =Open[i];
BufferDN1[i] =Low[i];
}
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments