Change_volume_alert
Download scriptThis tool is designed to monitor trading activity by tracking significant shifts in market volume. Its primary purpose is to notify you whenever there is a sudden and substantial increase in trading activity compared to the previous period.
How it Works
The script operates by continuously analyzing the "volume" data—which represents the amount of trading activity—on your current chart. Instead of constant monitoring, the logic is specifically programmed to trigger only at the exact moment a new candle (or bar) appears on the screen. This ensures that you receive clean, actionable alerts rather than repeated notifications during a single price movement.
The Core Logic
- Comparison Mechanism: When a new bar forms, the script looks back at the volume of the two most recently completed bars. It takes the volume from the previous bar and divides it by the volume from the bar before that.
- Volume Ratio: This calculation creates a ratio. For example, if the volume doubled compared to the previous period, the ratio would be 2.0.
- Threshold Detection: The script compares this ratio against a specific limit (a user-defined setting). If the growth in volume exceeds this limit, it signifies an "abnormal" or "high-interest" spike in market activity.
- Alert Delivery: Once the threshold is crossed, the system triggers an instant alert on your platform. The notification tells you exactly which currency pair or asset is experiencing the spike and provides the specific ratio of the volume increase.
Practical Application
This logic helps traders identify "volatility breakouts" or moments where large amounts of capital are entering the market rapidly. By setting a specific volume multiplier, you can filter out normal market noise and only be notified when there is a significant surge in trading intensity, potentially signaling a major trend change or news-driven movement.
//+------------------------------------------------------------------+
//| (Èçìåíåíèå îáúåìà) Change_volume_alert.mq4 |
//| Roll |
//+------------------------------------------------------------------+
#property copyright "Roll"
#property indicator_chart_window
extern double Opt_Volume=1.3;//îòíîñèò. çíà÷åíèå Volume
bool New_Bar=false;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init(){return(0);}
int deinit(){return(0);}
int start()
{Fun_New_Bar();
if(New_Bar==false)return;
double v_0=ND(Volume[1]);
double v_1=ND(Volume[2]);
double v_3=(v_0/v_1);
if(v_3>Opt_Volume){Alert(Symbol()," ",Period()," ìèí Îáúåì âûðîñ â ",v_3," ðàçà");}
return(0);}
//+----------íîðìàëèçàöèÿ-----------------------------+
double ND(double A){return(NormalizeDouble(A,Digits));}
//+-----Ô-èÿ îáíàðóæåíèÿ íîâîãî áàðà------------------+
void Fun_New_Bar()
{static datetime New_Time=0;//Âðåìÿ òåêóùåãî áàðà
New_Bar=false; //Íîâîãî áàðà íåò
if(New_Time!=Time[0]) //Ñðàâíèâàåì âðåìÿ
{New_Time=Time[0]; //Òåïåðü âðåìÿ òàêîå
New_Bar=true;}} //Ïîéìàëñÿ íîâûé áàð
Comments