The Damiani Volatmeter is a specialized technical analysis tool designed to help traders distinguish between meaningful market movements (signals) and background market "noise." By analyzing the relationship between short-term and long-term price fluctuations, it provides a visual gauge that identifies periods of high-quality volatility suitable for trading.
Core Logic and Mechanism
The script operates by comparing two different windows of time: a "fast" period (short-term volatility) and a "slow" period (long-term volatility). It treats the market like a fluid, looking for specific behaviors in how price movement expands or contracts.
1. Volatility Ratio Calculation The tool first calculates the Average True Range (ATR)—a standard measure of how much an asset moves over a specific time—for both the short and long periods. By dividing the short-term volatility by the long-term volatility, the script determines the "intensity" of the current price action relative to its historical context.
2. Lag Suppression and Smoothing To ensure that the readings are responsive and not delayed by old data, the logic includes a "lag suppressor." This mechanism compares previous values to smooth out erratic jumps, ensuring that the resulting signals are steady and representative of the current market state rather than temporary spikes.
3. The Signal/Noise Filter (The Threshold) The most critical part of the script is its ability to filter out insignificant price wiggles. It uses a "Standard Deviation" comparison to calculate a dynamic threshold.
- If the current volatility intensity exceeds this calculated threshold, the tool recognizes the movement as a Trade Signal.
- If the volatility is below this level, it identifies the movement as noise and classifies it as a Do Not Trade zone.
Visual Representation
The indicator provides immediate feedback on the trading environment:
- Dynamic Threshold Line: Shows the current "bar" that price must clear to be considered significant.
- Trade Zones: Highlights segments where the volatility meets the required criteria for entry.
- Real-time Status: The tool updates a text display on your chart, clearly stating whether the current conditions are suitable for trading or if you should remain on the sidelines based on the Signal/Noise analysis.
Summary for the Trader
Instead of just telling you where the price is going, the Damiani Volatmeter tells you how much confidence the market is showing in its current move. It aims to prevent traders from entering "choppy" markets where volatility is low and directionless, highlighting instead those moments where price action has enough momentum and strength to potentially be profitable.
//+------------------------------------------------------------------+
//| Damiani_volatmeter.mq4 |
//| Copyright © 2006, Luis Guilherme Damiani |
//| http://www.damianifx.com.br |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Luis Guilherme Damiani"
#property link "http://www.damianifx.com.br"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Silver
#property indicator_color2 FireBrick
#property indicator_color3 Lime
//---- input parameters
extern int Viscosity=7;
extern int Sedimentation=50;
extern double Threshold_level=1.1;
extern bool lag_supressor=true;
double lag_s_K=0.5;
//---- buffers
double thresholdBuffer[];
double vol_m[];
double vol_t[];
double ind_c[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,thresholdBuffer);
SetIndexStyle(1,DRAW_SECTION);
SetIndexBuffer(1,vol_m);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,vol_t);
ArrayResize(ind_c,Bars);
ArrayInitialize(ind_c,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double vol=0;
int changed_bars=IndicatorCounted();
//Comment("ATR ratio= "+short_atr+" / "+long_atr);
int limit=Bars-changed_bars;
if (limit>Sedimentation+5)limit=limit-Sedimentation;
for(int i=limit;i>=0;i--)
{
double sa=iATR(NULL,0,Viscosity,i);
double s1=ind_c[i+1];
double s3=ind_c[i+3];
double atr=NormalizeDouble(sa,Digits);
if(lag_supressor)
vol= sa/iATR(NULL,0,Sedimentation,i)+lag_s_K*(s1-s3);
else
vol= sa/iATR(NULL,0,Sedimentation,i);
//vol_m[i]=vol;
double anti_thres=iStdDev(NULL,0,Viscosity,0,MODE_LWMA,PRICE_TYPICAL,i);
anti_thres=anti_thres/
iStdDev(NULL,0,Sedimentation,0,MODE_LWMA,PRICE_TYPICAL,i);
double t=Threshold_level;
t=t-anti_thres;
if (vol>t){vol_t[i]=vol;vol_m[i]=vol;
IndicatorShortName("DAMIANI Signal/Noise: TRADE / ATR= "+DoubleToStr(atr,Digits)+" values:");}
else {vol_t[i]=vol;vol_m[i]=EMPTY_VALUE;
IndicatorShortName("DAMIANI Signal/Noise: DO NOT trade / ATR= "+DoubleToStr(atr,Digits)+" values:");}
ind_c[i]=vol;
thresholdBuffer[i]=t;
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
Comments