Power Weighted / Weighted delta free
Description
This custom indicator, is a difference between Power Weighted Moving Average and Weighted Moving Average.
Use for Bullish sentiment when indicator result is above the zero and Bearish when indicator result is below the zero
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; namespace cAlgo { [Levels(0)] [Indicator(IsOverlay = false, AccessRights = AccessRights.None)] public class mPWWdelta : Indicator { [Parameter("Period (14)", DefaultValue = 14)] public int inpPeriod { get; set; } [Parameter("Power (2.0)", DefaultValue = 2.0)] public double inpPower { get; set; } [Output("Power Weighted / Weighted delta", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)] public IndicatorDataSeries outPWWdelta { get; set; } double pw, summ, sumpw; private MovingAverage _wma; protected override void Initialize() { _wma = Indicators.MovingAverage(Bars.ClosePrices, inpPeriod, MovingAverageType.Weighted); } public override void Calculate(int i) { summ = 0; sumpw = 0; for(int j=0; j<inpPeriod; j++) { pw = Math.Pow(inpPeriod-j,inpPower); summ += pw * (i>inpPeriod+1 ? Bars.ClosePrices[i-j] : Bars.ClosePrices[i]); sumpw += pw; } outPWWdelta[i]= (sumpw!=0 ? summ/sumpw : double.NaN) - _wma.Result[i]; } } }
Comments