Description
The Damping Index Oscillator (DI) is designed to identify the damping of directed market movements.
Any value below 1.0 (by default) definitively indicates a slowing of price movement, regardless of its previous direction. In other words, when the indicator value is below the damping level, that period of time represents a time of sentiment accumulation and the best opportunity to open a position before the market triggers mark-up or mark-down.
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(0)]
[Cloud("Damping Index", "Damping Level", FirstColor = "Kagi", SecondColor = "Transparent", Opacity = 0.1)]
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class mDampingIndex : Indicator
{
[Parameter("Period (5)", DefaultValue = 5, MinValue = 2)]
public int inpPeriod { get; set; }
[Parameter("Smooth Type (sma)", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType inpSmoothType { get; set; }
[Parameter("Damping Level (1.0)", DefaultValue = 1.0, MinValue = 0)]
public double inpDampingLevel { get; set; }
[Output("Damping Index", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outDampingIndex { get; set; }
[Output("Damping Level", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
public IndicatorDataSeries outDampingLevel { get; set; }
private IndicatorDataSeries _delta, _dampingindex;
private MovingAverage _smoothhigh, _smoothlow;
protected override void Initialize()
{
_delta = CreateDataSeries();
_dampingindex = CreateDataSeries();
_smoothhigh = Indicators.MovingAverage(Bars.HighPrices, inpPeriod, inpSmoothType);
_smoothlow = Indicators.MovingAverage(Bars.LowPrices, inpPeriod, inpSmoothType);
}
public override void Calculate(int i)
{
_delta[i] = i>inpPeriod ? _smoothhigh.Result[i] - _smoothlow.Result[i] : Bars.HighPrices[i] - Bars.LowPrices[i];
_dampingindex[i] = _delta[i] / (i>inpPeriod+1 && _delta[i-inpPeriod] != 0 ? _delta[i-inpPeriod] : 1.0);
outDampingIndex[i] = _dampingindex[i];
outDampingLevel[i+100] = inpDampingLevel;
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mDampingIndex.algo
- Rating: 5
- Installs: 530
- Modified: 08/06/2023 11:49
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Se apprezzi l'algoritmo logico dell'indice di smorzamento, puoi anche utilizzare l'indicatore personalizzato fornito dopo il commento. Public ProAction ha una logica simile e, come proprietà aggiuntiva, mostra esattamente i Pips for Action.