Atr_3v1_3
Download scriptThis tool is designed to analyze market activity by comparing current price volatility against historical averages and identifying specific moments of high-intensity trading. Instead of just looking at the price movement, it evaluates the "energy" behind the market to help identify significant trends.
The logic operates based on three primary components:
1. Volatility Comparison
The script calculates a ratio between very recent price fluctuations (short-term volatility) and the average fluctuations over a much larger historical period (long-term volatility). By comparing these two, the tool can determine if the current market movement is unusually aggressive or relatively calm compared to its own history.
2. Relative Volume Analysis
Simultaneously, the script monitors trading volume. It calculates the average volume over a set period and compares the current volume against that average. This allows the tool to distinguish between "organic" movements (supported by high trading activity) and "weak" movements (low trading activity).
3. Signal Filtering and Identification
The core logic identifies specific "high-interest" zones where multiple conditions are met at once:
- Intensity Check: The current volatility and the current volume must both exceed a specific percentage threshold (the "Percent" setting).
- Stability Check: It ensures that while the activity is high, it hasn't reached an extreme, unsustainable peak (staying below double the target percentage).
- Dominance Check: It verifies that the volatility ratio is stronger than the volume ratio.
Visual Output
When these specific conditions are met, the script highlights the data on your chart:
- If the market price closed higher than it opened (a bullish movement), it marks the volatility data.
- If the market price closed lower than it opened (a bearish movement), it marks the volatility data accordingly.
Essentially, this tool filters out the "noise" of the market to highlight moments where significant price changes are backed by enough volume and momentum to be potentially meaningful.
//+------------------------------------------------------------------+
//| Atr_3v1.mq4 |
//| Copyright © 2006, HexSys Software Corp. |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, HexSys Software Corp."
#property link ""
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_buffers 5
#property indicator_color1 LightSteelBlue
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Yellow
#property indicator_color5 Red
//---- input parameters
extern int AtrMAX=480;
extern int Percent=90;
extern int mBars=480;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY, 1);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY, 2);
//SetIndexArrow(1,241);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY, 2);
//SetIndexArrow(2,242);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,ExtMapBuffer5);
//*
IndicatorDigits(2);
SetLevelStyle(STYLE_DOT,1,Yellow);
SetLevelValue(0,Percent);
SetLevelValue(1,Percent*2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
//for(int i=0;i<counted_bars;i++)
double s=0; int j=0;
for(j=1;j<=AtrMAX;j++) s=s+Volume[j];
s=s/(AtrMAX);
//for zero bar
ExtMapBuffer1[0]=(iATR(NULL,0,1,0)*100) / iATR(NULL,0,AtrMAX,0);
ExtMapBuffer4[0]=(Volume[0]*100) / s;
//for All bars...
for(int i=1;i<mBars;i++)
{
//ExtMapBuffer2[i]=iATR(NULL,0,AtrMAX,i);
ExtMapBuffer1[i]=(iATR(NULL,0,1,i)*100) / iATR(NULL,0,AtrMAX,i);
if (s==0) s=1;
ExtMapBuffer4[i]=(Volume[i]*100) / s;
if(ExtMapBuffer4[i]>Percent && ExtMapBuffer1[i]>Percent &&
ExtMapBuffer4[i]<Percent*2 && ExtMapBuffer1[i]<Percent*2 &&
ExtMapBuffer1[i]>ExtMapBuffer4[i])
{
if (Open[i]<Close[i]) ExtMapBuffer2[i]=ExtMapBuffer1[i];
if (Open[i]>Close[i]) ExtMapBuffer3[i]=ExtMapBuffer1[i];
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments