Author: Poul Trade Forum
EVWMA_v1

This tool is designed to provide a visual representation of market trends by calculating a specialized type of moving average. Unlike standard averages that simply look at price changes over time, this script incorporates trading volume as a primary factor in determining the trend's direction and strength.

How the Logic Works

The core functionality revolves around analyzing the relationship between price action and the volume of trades occurring at any given moment. Here is a breakdown of the underlying logic:

Volume Scaling and Comparison The script takes the trading volume of each period and adjusts it based on a specific divisor provided by the user. It then compares this adjusted volume against a set threshold (a constant value). This comparison is used to determine if the market is showing significant activity or if the current volume is exceeding the expected "normal" levels.

The Dynamic Calculation When the volume stays within normal parameters, the script calculates the indicator line by balancing two components:

  1. The difference between the threshold and the actual scaled volume.
  2. The current closing price of the asset.

By combining these, the indicator attempts to smooth out price fluctuations while giving more weight to the intensity of the trading activity. It effectively creates a "weighted" path that reacts differently depending on how much volume is flowing through the market.

Handling Volume Spikes (Violations) One unique feature of this script is its "Violation" logic. If the trading volume becomes excessively high—surpassing the defined threshold—the script identifies this as a deviation. When such a spike occurs, the indicator pauses its normal calculation and carries over the previous value of the line.

This prevents extreme, one-off volume surges from distorting the trend line, ensuring that the visual output remains stable and representative of the broader market movement rather than reacting erratically to momentary "noise."

Summary for the User

Essentially, this tool helps you visualize a smoothed trend that is sensitive to volume but protected against being skewed by outliers. It aims to provide a clearer picture of where the price is heading by factoring in how much conviction (volume) is behind the current price movement.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
EVWMA_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                            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