Author: Poul Trade Forum
EVWMA

This script functions as a specialized moving average indicator designed to filter out market noise by reacting differently to trading volume. Unlike standard indicators that treat every price movement with equal weight, this tool adjusts its calculations based on whether the current trading volume exceeds a specific threshold set by the user.

How the Logic Works

The core purpose of this indicator is to "smooth" the price trend while remaining sensitive to significant market activity. It achieves this through three main logical steps:

1. Volume Scaling and Threshold Detection The script looks at the trading volume for each specific candle on the chart. It compares this volume against a user-defined limit (the "N" value). This creates a baseline to determine if the current market activity is considered "normal" or "extreme."

2. The "Violation" Logic This is the unique heart of the script. The logic identifies a "Violation"—a moment where the trading volume becomes exceptionally high (exceeding the designated limit).

  • When the volume stays within the normal range, the indicator calculates a weighted average that combines both the current price and the previous trend.
  • However, when a "Violation" occurs (meaning the volume is too high), the script identifies this as a potential period of extreme volatility or erratic movement.

3. Trend Preservation Instead of allowing these high-volume spikes to distort the moving average line and cause it to jump erratically, the script chooses to "freeze" the value. During a violation, the indicator maintains the value of the previous candle's trend rather than incorporating the new, volatile price data.

Summary for Traders

In plain terms, this indicator acts as a sophisticated filter. It follows the price trend smoothly during standard market conditions but essentially "ignores" the price action during periods of extreme, high-volume spikes. By doing this, it aims to provide a cleaner visual representation of the trend, preventing the indicator line from being misled by sudden, isolated bursts of activity that might not represent a sustained change in direction.

Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
EVWMA
//+------------------------------------------------------------------+
//|                                                            EVWMA |
//|                               Copyright © 2004, Poul_Trade_Forum |
//|                                                         Aborigen |
//|                                          http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Poul Trade Forum"
#property link      "http://forex.kbpauk.ru/"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DeepPink



extern int VolumeDivisor=1;
extern int N=100;

double  ScaledVol=0, VolDiff=0;
double X[100], Y[100];
bool Violation=false;

//---- buffers
double EVWMA[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_LINE,EMPTY,2,DeepPink);
   SetIndexBuffer(0,EVWMA);
   SetIndexEmptyValue(0,0);
//---- name for DataWindow and indicator subwindow label
   short_name="EVWMA";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {    return(0);   }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted(),i,shift,count;

if (counted_bars==0) {EVWMA[Bars] = Close[Bars]; counted_bars=1;}

i=(Bars-counted_bars);

for (shift=i; shift>=0;shift--)
{
ScaledVol = Volume[shift]/VolumeDivisor;
 VolDiff = N - ScaledVol;
 if ( VolDiff<0 && Violation==false)  Violation = true;
 if (Violation==true)  EVWMA[shift]=EVWMA[shift+1]; 
 else EVWMA[shift] = (VolDiff * EVWMA[shift+1] + ScaledVol * Close[shift]) / N ;
Violation=false;


//----

}

   return(0);
  }
//+------------------------------------------------------------------+


Comments