WAVE-PM (Whistler's Active Volatility Energy - Price Mass)

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Re: WAVE-PM (Whistler's Active Volatility Energy - Price Mas

Postby Apprentice » Sat Oct 22, 2016 6:25 am

MT4 / MQ4 version can be found here.
viewtopic.php?f=38&t=64011
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 18849
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: WAVE-PM (Whistler's Active Volatility Energy - Price Mas

Postby Asack55 » Sun Nov 20, 2016 4:53 pm

Is it possible to port over a version of WVAV? I noticed the VAMA indicator used time based periods instead of the 5000/10000 tick levels used in WVAV.

Code: Select all
Copyright © Mark Whistler 2009 / fxVolatility.com.   //+--------------------------------------------------+ //|Whistler Volume Adjusted Volatility - WVAV       | //|                                                 | //| Copyright 2009, fxVolatility.com                | //| Authors: Mark Whistler/EcTrader.net             | //| Mark@WallStreetRockStar.com                     | //|www.WallStreetRockStar.com|www.fxVolatility.com. | //+--------------------------------------------------+ #property copyright "Copyright 2009, Mark Whistler" #property link "http://www.wallstreetrockstar.com"     //---- #property indicator_chart_window #property indicator_buffers 5 #property indicator_color1 Red #property indicator_color2 DarkGoldenrod #property indicator_color3 Black   #property indicator_color4 Black #property indicator_color5 Black //---- input parameters extern int MA_Ticks = 10000; extern int MA_Shift = 0; extern int MA_Start = 500; //---- indicator parameters1 extern string aa="*****************************"; //---- indicator parameters extern bool MidBandVisible=false; extern int    BandsPeriod=14; extern int    BandsShift=0; extern double BandsDeviations=3.2;   //---- indicator buffers double ExtMapBuffer[]; double ExpVolBuffer[]; //---- buffers //---- double MovingBuffer[]; double UpperBuffer[]; double LowerBuffer[]; //--------------     //+---------------------------------------------------+ //|Custom Indicator Initialization                    | //+---------------------------------------------------+     int init()   { //----    SetIndexStyle(0, DRAW_LINE);

   SetIndexShift(0, MA_Shift); //---- indicator buffers mapping    SetIndexBuffer(0, ExtMapBuffer);    SetIndexStyle(1, DRAW_NONE);    SetIndexBuffer(1, ExpVolBuffer);    SetIndexDrawBegin(0, 0);  //---- initialization done //---- indicators    SetIndexStyle(2,DRAW_LINE);    SetIndexBuffer(2,ExtMapBuffer);    SetIndexStyle(3,DRAW_LINE);    SetIndexBuffer(3,UpperBuffer);    SetIndexStyle(4,DRAW_LINE);    SetIndexBuffer(4,LowerBuffer);   //----    SetIndexDrawBegin(2,BandsPeriod+BandsShift);    SetIndexDrawBegin(3,BandsPeriod+BandsShift);    SetIndexDrawBegin(4,BandsPeriod+BandsShift);    return(0);   }   //+---------------------------------------------------+ //|Custom Indicator Initialization                    | //+---------------------------------------------------+     int start()   {    int counted_bars = IndicatorCounted();

   int rest  = Bars - counted_bars;    int restt = Bars - counted_bars;    double sumVol;                                  int ts;                                      int evol;                                    int volsum;    int j;    int i;      //---------------Begin Add MA-----------------------    double deviation;    double sum, oldval,newres; //----    if(Bars<=BandsPeriod) return(0); //---- initial zero    if(counted_bars<1)       for(i=1;i<=BandsPeriod;i++)         {          ExtMapBuffer[Bars-i]=EMPTY_VALUE;          UpperBuffer[Bars-i]=EMPTY_VALUE;          LowerBuffer[Bars-i]=EMPTY_VALUE;         }   int limit=Bars-counted_bars;    if(counted_bars>0) limit++;    for(i=0; i<limit; i++)       {         ExtMapBuffer[i]=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);       }

   //---------------End Add MA-----------------------     //---------Begin Volume MA--------------------------      while(restt >= 0)      {        volsum = 0;        for(int k = 0; k < 30; k++)            volsum += iVolume(NULL, 0, restt + k*24);        ExpVolBuffer[restt] = volsum / 30;        restt--;      } //----    while(ExpVolBuffer[rest] == 0 && rest >= 0)        rest--;    rest -= MA_Ticks / 200;    if(rest > MA_Start)        rest = MA_Start;  //----    while(rest >= 0)      {        sumVol = 0;        ts = 0;        j = rest;        while(ts < MA_Ticks)          {            evol = ExpVolBuffer[j];   //----         Print("Evol = ", evol);            if(ts + evol < MA_Ticks)              {

               sumVol += evol * Open[j];                ts += evol;              }            else              {                sumVol += (MA_Ticks - ts) * Open[j];                ts = MA_Ticks;              }            j++;          }        ExtMapBuffer[rest] = sumVol / MA_Ticks;        rest--;      }     //----------------------End Volume MA-----------------    //---------------------Begin Bollinger Band-----------     //----      i=Bars-BandsPeriod+1;    if(counted_bars>BandsPeriod-1) i=Bars-counted_bars-1;    while(i>=0)      {       sum=0.0;       k=i+BandsPeriod-1;       oldval=ExtMapBuffer[i];       while(k>=i)         {          newres=Close[k]-oldval;          sum+=newres*newres;

         k--;         }       deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);       UpperBuffer[i]=oldval+deviation;       LowerBuffer[i]=oldval-deviation;       i--;      } //----   //-----------------------End Band--------------------- //----    return(0);

Asack55
 
Posts: 14
Joined: Thu Jun 16, 2016 12:42 pm

Previous

Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot], netwheat and 14 guests