Description
This is a Simple Acceleration Deceleration Oscillator with Multiple Colors for a Better Visualization of the Histogram Trend.
Grupo CTrader em Portugues -->> https://t.me/ComunidadeCtrader
Para los que quieran participar de un Grupo CTrader en Español poder compartir estrategias, indicadores e mucho más, aquí abajo les dejo el link.
Grupo CTrader en Español -->> https://t.me/ComunidadCtrader
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class ACDCOscilator : Indicator
{
[Output("Strong Bullish", LineColor = "ForestGreen", PlotType = PlotType.Histogram, Thickness = 4)]
public IndicatorDataSeries StrongBullish { get; set; }
[Output("Weak Bullish", LineColor = "LawnGreen", PlotType = PlotType.Histogram, Thickness = 4)]
public IndicatorDataSeries WeakBullish { get; set; }
[Output("Strong Bearish", LineColor = "Red", PlotType = PlotType.Histogram, Thickness = 4)]
public IndicatorDataSeries StrongBearish { get; set; }
[Output("Weak Bearish", LineColor = "DarkSalmon", PlotType = PlotType.Histogram, Thickness = 4)]
public IndicatorDataSeries WeakBearish { get; set; }
private SimpleMovingAverage fastSma;
private SimpleMovingAverage slowSma;
private IndicatorDataSeries AcDcOscillator;
private SimpleMovingAverage movingAverage;
private IndicatorDataSeries medianprice;
protected override void Initialize()
{
medianprice = CreateDataSeries();
fastSma = Indicators.SimpleMovingAverage(medianprice, 5);
slowSma = Indicators.SimpleMovingAverage(medianprice, 34);
AcDcOscillator = CreateDataSeries();
movingAverage = Indicators.SimpleMovingAverage(AcDcOscillator, 5);
}
public override void Calculate(int index)
{
medianprice[index] = (Bars.HighPrices[index] + Bars.LowPrices[index]) / 2;
AcDcOscillator[index] = fastSma.Result[index] - slowSma.Result[index];
double prev = AcDcOscillator[index - 1] - movingAverage.Result[index - 1];
double current = AcDcOscillator[index] - movingAverage.Result[index];
if (current > 0.0)
{
if (current >= prev)
{
StrongBullish[index] = current;
}
else if (current < prev)
{
WeakBullish[index] = current;
}
}
else if (current < 0.0)
{
if (current <= prev)
{
StrongBearish[index] = current;
}
else if (current > prev)
{
WeakBearish[index] = current;
}
}
}
}
}
TraderExperto
Joined on 07.06.2019
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Acellerator Decelerator Oscillator MultiColor.algo
- Rating: 0
- Installs: 1634
- Modified: 13/10/2021 09:54
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.