Damiani_volatmeter_v3

Download script
Author: Copyright � 2006, Luis Guilherme Damiani
Damiani_volatmeter_v3

The Damiani Volatmeter is a specialized technical analysis tool designed to help traders distinguish between meaningful market movements and insignificant "noise." By analyzing the relationship between different scales of market volatility, it aims to identify periods where the price action is strong enough to warrant a trade versus moments where the market is simply fluctuating without direction.

How the Logic Works

The indicator operates by comparing two different speeds of market volatility simultaneously:

  • Short-Term Volatility (Viscosity): This looks at rapid, immediate price changes over a small number of bars.
  • Long-Term Volatility (Sedimentation): This looks at the broader, more stable trend of price movement over a much larger period.

By dividing the short-term volatility by the long-term volatility, the script calculates a "Signal-to-Noise" ratio. In simpler terms, it is trying to determine if the current "shaking" of the market is large relative to its usual behavior.

Key Mechanics and Features

1. The Signal/Noise Ratio The tool calculates a dynamic value based on the ratio described above. If this ratio exceeds a specific threshold (set by the user), it suggests that the current price movement has significant momentum. If the ratio remains below the threshold, the market is considered "noisy" or stagnant, implying that trades taken during this time may lack sufficient strength.

2. Lag Suppression The script includes a toggleable feature called "Lag Suppressor." Market indicators often suffer from "lag," where the visual signal appears after the move has already happened. This logic attempts to smooth out these delays by incorporating data from previous bars, helping the indicator react more fluidly to real-time changes.

3. Dynamic Thresholding Rather than using a fixed number as a cutoff point, the script adjusts its requirements based on standard deviation (the degree of variation in the market). This means the "hurdle" the price must jump over to be considered a valid signal automatically adjusts as market conditions become more or less erratic.

Visual Interpretation for the Trader

The tool provides immediate visual feedback directly on your chart's indicator window:

  • Trade Signals: When the calculated volatility exceeds the dynamic threshold, the indicator identifies the environment as a "TRADE" zone. This indicates that the current price movement is significant enough to be considered a valid trend or breakout.
  • Do Not Trade Zones: When the price action fails to meet the requirements, the tool flags the area as "DO NOT trade." This serves as a warning that while the price is moving, it lacks the necessary relative strength to be reliable, helping traders avoid "fake-outs" or choppy sideways markets.
  • Real-Time Data: The indicator also displays the current ATR (Average True Range) values on the screen, allowing you to see exactly how much the market is moving in points/pips at any given moment.
Indicators Used
Indicator of the average true rangeStandard Deviation indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
Damiani_volatmeter_v3
//+------------------------------------------------------------------+
//|                                           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=40;
extern double    Threshold_level=1.40;
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