prusax_v61_v1
Download scriptThis script is a visual trading tool designed for the MetaTrader platform to help traders identify price action trends and volatility by plotting specific price data points directly on the chart. Rather than relying on complex lagging averages, it focuses on the relationship between the high, low, open, and close prices of individual candles to highlight momentum.
How the Logic Works
The script analyzes every candle on your chart and categorizes its behavior into two primary movements: upward (bullish) and downward (bearish). It uses four distinct visual layers—represented as histograms—to map these movements:
1. Upward Momentum Tracking When the script detects a bullish candle (where the closing price is higher than the opening price), it activates the "Up" indicators.
- It maps the highest point reached during that period.
- It also tracks the starting point of that move (the opening price) to show where the buying pressure began.
2. Downward Momentum Tracking Conversely, when the script detects a bearish candle (where the closing price is lower than the opening price), it activates the "Down" indicators.
- It highlights the starting price of the drop.
- It maps the lowest point reached during that period to visualize the extent of the selling pressure.
3. Dynamic Calculation for Initial Data For the most recent data points on the live chart, the script employs a specific mathematical formula to estimate the center of price action. It calculates the relationship between the distance from the high to the open and the close to the low. This ensures that as a candle is still forming in real-time, the tool provides a calculated visual representation of where the current price pressure is balanced.
Summary for Traders
Essentially, this tool acts as a visual filter. By highlighting the extremes (Highs and Lows) and the transition points (Opens) based on the direction of the candle, it allows you to see at a glance whether the market is favoring buyers or sellers. It simplifies price action by isolating the most important price levels for each completed bar, making it easier to identify trend shifts and price boundaries.
//+------------------------------------------------------------------+
//| 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