How could i add Slowing to this code?
Created at 15 Dec 2021, 22:37
How could i add Slowing to this code?
15 Dec 2021, 22:37
how could i add slowing to this code?
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Levels(1)]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class AWStochasticLimitless : Indicator
{
private double UpperResult1;
private double LowerResult1;
[Parameter("K% periods 1", DefaultValue = 5)]
public int inpKPeriods1 { get; set; }
[Parameter("K% Slowing", DefaultValue = 1)]
public int inpKSlowing { get; set; }
[Output("K% 1", LineColor = "Black", LineStyle = LineStyle.Dots, Thickness = 2)]
public IndicatorDataSeries k1 { get; set; }
protected override void Initialize()
{
}
public override void Calculate(int index)
{
UpperResult1 = Bars.HighPrices.Maximum(inpKPeriods1);
LowerResult1 = Bars.LowPrices.Minimum(inpKPeriods1);
k1[index] = (Bars.ClosePrices[index]) / ((UpperResult1 + LowerResult1) / 2);
}
}
}
amusleh
16 Dec 2021, 11:12
Hi,
You just have to add a simple moving average over your K output:
@amusleh