This indicator is a stripped down (no MTF/shift) version of my indicator. Taken without proper acknowledgment.
Indicator Code | My Code |
---|---|
for(int i=limit; i>=0 && !IsStopped(); i--) { double Ew=0, Ewx=0; for(int j=i; j<=i+period; j++) { double Ed=0; for(int n=i; n<=i+period; n++) Ed+=fabs(BufferMA[j]-BufferMA[n]); double w=(period-1)/fmax(Ed,Point()); Ew+=w; Ewx+=w*BufferMA[j]; } BufferIDWMA[i]=(Ew!=0 ? Ewx/Ew : EMPTY_VALUE); | for(iBar = Bars - 1 - counted_bars; iBar >= 0; iBar--){ // reference //en.wikipedia.org/wiki/Distance-weighted_estimator // W[i] = (n-1)/E[j=1..n]|x[i]-x[j]| // ave[i] = E[i=1..n](W[i]X[i]) / E[i=1..n]W[i] double Ewx=0, Ew=0; int iLimit = iBar + MA_Period; for(int iWeight = iBar; iWeight < iLimit; iWeight++){ double Ed = 0.; for(int iDist = iBar; iDist < iLimit; iDist++){ Ed += MathAbs(prices[iWeight] - prices[iDist]); } double w = (MA_Period - 1) / MathMax(Ed, Point); Ew += w; Ewx += w * prices[iWeight]; } MAs[iBar] = Ewx / Ew; |

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
IDWMA:
Indicator Inverse Distance Weighted Moving Average.
Author: Scriptor