Atr_3v1_3_time
Download scriptThis technical indicator is designed to analyze market behavior by comparing current price volatility and trading volume against historical averages. Instead of looking at raw numbers, it focuses on relative proportions to help identify specific types of market activity.
Core Methodology
The script operates by scanning a significant amount of historical data (up to 4,000 bars) to establish "normal" benchmarks. It specifically categorizes these benchmarks by the hour of the day. This allows the tool to understand what a typical volume level and price movement look like at any given time, accounting for the fact that markets behave differently during peak sessions versus overnight periods.
Key Metrics Tracked
The logic processes two primary types of data:
- Volatility (ATR): It measures how much the price is swinging. The script calculates a moving average of these swings based on the hour of the day.
- Volume: It measures the amount of trading activity occurring. Similarly, it creates a baseline for volume based on historical hourly data.
By comparing the current bar's volatility and volume against these hourly averages, the indicator produces a percentage-based representation. This tells you how "extreme" the current market activity is compared to what usually happens at that specific time of day.
Visual Logic and Signals
The indicator populates a separate window with several visual elements:
- Relative Performance Lines: It plots lines that show the current percentage of volatility and volume relative to the historical norms.
- Dynamic Thresholds: The script uses predefined levels (based on a user-set percentage and a multiplier) to act as boundaries for "significant" activity.
- Filtered Signals: The tool looks for a specific "sweet spot" where both volatility and volume exceed a certain intensity threshold, but remain within a specific range (not overextended).
- Directional Confirmation: When this specific level of activity is detected, the script checks the price action of the candle. If the price closed higher than it opened during this high-activity period, it highlights a bullish signal; if it closed lower, it highlights a bearish signal.
Summary for the User
Essentially, this tool filters out "background noise" in the market. Rather than alerting you to every small price move, it identifies moments where the market is experiencing significant, concentrated activity relative to its usual hourly behavior, helping traders spot high-importance price movements more clearly.
//+------------------------------------------------------------------+
//| 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_level1 0
#property indicator_level2 0
#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=4000;
extern int Percent=90;
extern int mBars=200;
extern int Koeff=3;
//---- 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*Koeff);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double aATR[25],aVol[25];
//----
//for(int i=0;i<counted_bars;i++)
double s=0; int j=0;
int sh=0,H=0,kol=0;
for(j=1;j<=AtrMAX;j++)
{
H=TimeHour(Time[j]);
if (H==0) kol++;
if (aATR[H]==0) aATR[H]=iATR(NULL,0,1,j);
else aATR[H]=(aATR[H]+iATR(NULL,0,1,j))/2;
if (aVol[H]==0) aVol[H]=Volume[j];
else aVol[H]=(aVol[H]+Volume[j])/2;
}
Comment(kol);
//for zero bar
H=TimeHour(Time[0]);
ExtMapBuffer1[0]=(iATR(NULL,0,1,0)*100) / aATR[H];
ExtMapBuffer4[0]=(aVol[0]*100) / aVol[H];
//for All bars...
for(int i=1;i<mBars;i++)
{
H=TimeHour(Time[i]);
//ExtMapBuffer2[i]=iATR(NULL,0,AtrMAX,i);
ExtMapBuffer1[i]=(iATR(NULL,0,1,i)*100) / aATR[H];
s=aVol[H]; if (s==0) s=1;
ExtMapBuffer4[i]=(Volume[i]*100) / s;
if(ExtMapBuffer4[i]>Percent && ExtMapBuffer1[i]>Percent &&
ExtMapBuffer4[i]<Percent*Koeff && ExtMapBuffer1[i]<Percent*Koeff &&
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