Description
Just Kijun-Sen from Ichimoku system. Plain and simple
Shift option is added and 2 different modes for calculation
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class KijunSen : Indicator
{
public enum Mode
{
Close,
HighLow
}
[Parameter("Period", DefaultValue = 26)]
public int Period { get; set; }
[Parameter("Shift", DefaultValue = 0)]
public int shift { get; set; }
[Parameter("Mode", DefaultValue = Mode.HighLow)]
public Mode Moden { get; set; }
[Output("Middle", LineColor = "Gray", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
public IndicatorDataSeries MiddleResult { get; set; }
private double UpperResult;
private double LowerResult;
protected override void Initialize()
{
}
public override void Calculate(int index)
{
UpperResult = (Moden == Mode.Close) ? Bars.ClosePrices.Maximum(Period) : Bars.HighPrices.Maximum(Period);
LowerResult = (Moden == Mode.Close) ? Bars.ClosePrices.Minimum(Period) : Bars.LowPrices.Minimum(Period);
MiddleResult[index + shift + 1] = LowerResult + ((UpperResult - LowerResult) / 2);
}
}
}
KA
kaneida84
Joined on 25.04.2021
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Kijun Sen.algo
- Rating: 5
- Installs: 2092
- 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.
Perfect — that is exactly what I needed! Thanks for putting the effort, I apprecate!