Description
The Derivative Oscillator indicator by Constance Brown was published in her book "Technical Analysis for the Trading Professional"
Use as standard DPO (detrended price oscillator) indicator.
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 mDerivativeOsc : Indicator
{
[Parameter("RSI Period (10)", DefaultValue = 10, MinValue = 2)]
public int inpPeriodRSI { get; set; }
[Parameter("Period First (5)", DefaultValue = 5, MinValue = 2)]
public int inpPeriodFirst { get; set; }
[Parameter("Period Second (3)", DefaultValue = 3, MinValue = 2)]
public int inpPeriodSecond { get; set; }
[Parameter("Period Smooth (9)", DefaultValue = 9, MinValue = 2)]
public int inpPeriodSmooth { get; set; }
[Output("Derivative ", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries outDerivative { get; set; }
private RelativeStrengthIndex _rsi;
private MovingAverage _first, _second, _smooth;
private IndicatorDataSeries _result;
protected override void Initialize()
{
_rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, inpPeriodRSI);
_first = Indicators.MovingAverage(_rsi.Result, inpPeriodFirst, MovingAverageType.Exponential);
_second = Indicators.MovingAverage(_first.Result, inpPeriodSecond, MovingAverageType.Exponential);
_smooth = Indicators.MovingAverage(_first.Result, inpPeriodSmooth, MovingAverageType.Simple);
_result = CreateDataSeries();
}
public override void Calculate(int i)
{
_result[i] = _second.Result[i] - _smooth.Result[i];
outDerivative[i] = _result[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mDerivativeOsc.algo
- Rating: 5
- Installs: 534
- Modified: 16/05/2023 11:26
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.
Comments
Log in to add a comment.
No comments found.