Author: Poul Trade Forum
EVWMA_v2

This indicator, known as the EVWMA, is designed to provide a smoothed price line on your trading chart that reacts dynamically to market volume. Unlike standard moving averages that only look at price history, this tool incorporates "volume intensity" to determine how much weight to give to recent market movements.

Core Logic and Behavior

The primary objective of the script is to calculate a weighted average where the influence of the current price is dictated by the trading volume. It achieves this through three main logical steps:

1. Volume Scaling and Comparison The indicator begins by looking at the trading volume of each specific candle. It takes this volume and compares it against a user-defined threshold (the "N" value). This allows the script to distinguish between "normal" market activity and periods of exceptionally high liquidity or interest.

2. The "Violation" Mechanism A key feature of this logic is its ability to detect significant spikes in volume. When the market volume exceeds the predefined limit, the indicator flags what it considers a "Violation." This signifies that the current volume is high enough to potentially distort a standard moving average calculation.

3. Dynamic Price Smoothing The script then adjusts its output based on whether that volume violation is occurring:

  • Normal Activity: When volume is within expected limits, the indicator calculates a smooth line by blending the difference between the threshold and the current volume with the previous smoothed price and the current closing price. This results in a steady, fluid trend line.
  • High Volume Activity: If the volume "Violation" occurs, the logic shifts. Instead of recalculating based on the new price volatility, it maintains the value of the previous calculation for that period. This effectively prevents the indicator line from reacting erratically to extreme, one-off volume spikes, keeping the trend line stable during periods of intense market exhaustion or news-driven volatility.

Summary for the Trader

In simple terms, this indicator acts as a "smart" moving average. It tries to follow the price closely during standard market conditions but purposefully holds its ground and remains steady when it detects massive surges in volume. By doing this, it aims to filter out "noise" and provide a clearer view of the underlying trend without being misled by temporary spikes in trading activity.

Miscellaneous
Implements a curve of type %1
7 Views
0 Downloads
0 Favorites
EVWMA_v2
//+------------------------------------------------------------------+
//|                                                            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