Damiani_volatmeter_v1

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

This tool is designed to help traders distinguish between significant market movements and standard background "noise." By analyzing the relationship between different speeds of price volatility, it attempts to identify high-quality signals that are likely to be meaningful for trading decisions.

Core Logic Overview

The script operates by comparing two different perspectives of market volatility: a "fast" view (short-term) and a "slow" view (long-term). It calculates the ratio between these two views to determine the current intensity of the market.

The underlying logic works as follows:

  • Volatility Comparison: The tool measures how much the price is moving over a short period compared to a much longer period. If the short-term volatility is significantly higher than the long-term average, it suggests a potential breakout or a meaningful trend shift.
  • Signal vs. Noise Filtering: Not every price movement is a valid trading opportunity. This script uses a specific "Threshold Level" to filter out minor fluctuations. It calculates a dynamic boundary; if the calculated volatility exceeds this threshold, the tool flags the movement as a potential trade signal.
  • Lag Reduction: The logic includes an optional feature to smooth out the data. By looking at previous values and subtracting their differences, the script tries to provide more immediate feedback, reducing the delay that often occurs with standard moving averages or volatility indicators.

How it Displays Information

The tool provides visual feedback on your chart to guide your trading:

  • Trade Signals: When the market activity exceeds the calculated threshold (indicating a high-quality signal), the indicator highlights the data visually and updates the display name to "TRADE."
  • No-Trade Zones: When the price movement is considered normal background noise or too weak to be reliable, the tool suppresses the visual highlight and updates the display name to "DO NOT trade."
  • Dynamic Monitoring: The tool continuously monitors the Average True Range (ATR) and Standard Deviation of the current asset, ensuring that the "Threshold" adjusts as the market's overall personality changes.

Summary for the User

In simple terms, this script acts as a filter. It looks at the "heartbeat" of the market and tells you when that heartbeat becomes strong enough to act upon. Instead of reacting to every small wiggle in the price, it helps you wait for those moments where the volatility is high enough to be considered a legitimate opportunity, helping to avoid "fake-outs" caused by low-intensity market noise.

Indicators Used
Indicator of the average true rangeStandard Deviation indicator
Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
Damiani_volatmeter_v1
//+------------------------------------------------------------------+
//|                                           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=13;
extern int       Sedimentation=50;
extern double    Threshold_level=1.3;
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