//------------------------------------------------------------------ #property copyright "www.forex-tsd.com" #property link "www.forex-tsd.com" // // originaly developed by Markos Katsanos // first published in TASC june 2004 // //------------------------------------------------------------------ #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 DarkGray #property indicator_color2 PaleVioletRed #property indicator_color3 DeepSkyBlue #property indicator_color4 DeepSkyBlue #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_style1 STYLE_DOT #property indicator_level1 0 // // // // // extern double VfiCoeff = 0.2; extern int VfiPeriod = 130; extern int VfiPrice = PRICE_TYPICAL; extern double VolumeCoeff = 2.5; extern int SmoothPeriod = 3; double vfi[]; double vfs[]; double vfsua[]; double vfsub[]; //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // int init() { SetIndexBuffer(0,vfi); SetIndexBuffer(1,vfs); SetIndexBuffer(2,vfsua); SetIndexBuffer(3,vfsub); return(0); } int deinit() { return(0); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // double work[][6]; #define _price 0 #define _volume 1 #define _voluma 2 #define _dvol 3 #define _vfi 4 #define _trend 5 // // // // // int start() { int i,r,count,counted_bars=IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); if (ArrayRange(work,0)!=Bars) ArrayResize(work,Bars); if (work[Bars-limit-1][_trend]==-1) CleanPoint(limit,vfsua,vfsub); // // // // // double alpha = 2.0 / (1.0+SmoothPeriod); for(i = limit, r=Bars-i-1; i >= 0; i--,r++) { work[r][_price] = iMA(NULL,0,1,0,MODE_SMA,VfiPrice,i); work[r][_volume] = Volume[i]; work[r][_voluma] = 0; if (r==0) continue; work[r][_voluma] = work[r][_volume]; for (int k=1; k cutoff) directionalVolume = vc; if (mf<-cutoff) directionalVolume = -vc; // // // // // work[r][_dvol] = directionalVolume; work[r][_vfi] = directionalVolume; for (k=1; k0) work[r][_trend]= 1; if (vfs[i]<0) work[r][_trend]=-1; if (work[r][_trend]==1) PlotPoint(i,vfsua,vfsub,vfs); } return(0); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // double array[]; double iDeviation(double value, double period, int i) { if (ArraySize(array)!=Bars) ArrayResize(array,Bars); i= Bars-i-1; array[i] = value; double avg = 0; for(int k=0; k