Description
Ichimoku displays as a point
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.None, AutoRescale = false)]
public class Japsian : Indicator
{
#region parameters
[Parameter("TenkanSen", DefaultValue = 9, MinValue = 1, Group = "Period")]
public int TenkanSenPeriods { get; set; }
[Parameter("KijunSen", DefaultValue = 26, MinValue = 1, Group = "Period")]
public int KijunSenPeriods { get; set; }
[Parameter("SenkouSpanB", DefaultValue = 52, MinValue = 1, Group = "Period")]
public int SenkouSpanBPeriods { get; set; }
[Parameter("KijunSen extra1", DefaultValue = 103, MinValue = 1, Group = "Period")]
public int KijunSenExtra1Periods { get; set; }
[Parameter("KijunSen extra2", DefaultValue = 207, MinValue = 1, Group = "Period")]
public int KijunSenExtera2Periods { get; set; }
[Parameter("TenkanSen +17", DefaultValue = 9, MinValue = 1, Group = "Period")]
public int TenkanSen17Periods { get; set; }
[Parameter("QualityLine", DefaultValue = 26, MinValue = 1, Group = "Period")]
public int QualityLinePeriod { get; set; }
[Parameter("DirectionLine", DefaultValue = 26, MinValue = 1, Group = "Period")]
public int DirectionLinePeriod { get; set; }
[Parameter("ChikouSpan Shift", DefaultValue = -26, MaxValue = 9999, Group = "Shift")]
public int ChikouSpanShift { get; set; }
[Parameter("Kumo Shift", DefaultValue = 26, MinValue = -9999, Group = "Shift")]
public int KumoShift { get; set; }
[Parameter("TenkanSen +17", DefaultValue = 17, MinValue = -9999, Group = "Shift")]
public int TenkanSen17Shift { get; set; }
[Parameter("QualityLine", DefaultValue = 26, MinValue = -9999, Group = "Shift")]
public int QualityLineShift { get; set; }
[Parameter("DirectionLine", DefaultValue = -26, MaxValue = 9999, Group = "Shift")]
public int DirectionLineShift { get; set; }
[Parameter("KijunSen extra1", DefaultValue = 0, MinValue = -9999, Group = "Shift")]
public int KijunSenExtra1Shift { get; set; }
[Parameter("KijunSen extra2", DefaultValue = 0, MinValue = -9999, Group = "Shift")]
public int KijunSenExtra2Shift { get; set; }
[Output("TenkanSen", PlotType = PlotType.Points, LineColor = "Red", Thickness = 2)]
public IndicatorDataSeries TenkanSenResult { get; set; }
[Output("KijunSen", PlotType = PlotType.Points, LineColor = "Blue", Thickness = 2)]
public IndicatorDataSeries KijunSenResult { get; set; }
[Output("ChikuSpan", PlotType = PlotType.Line, LineColor = "Green")]
public IndicatorDataSeries ChikouSpanResult { get; set; }
[Output("SenkouSpanA", PlotType = PlotType.Points, LineColor = "Green", Thickness = 2)]
public IndicatorDataSeries SenkouSpanAResult { get; set; }
[Output("SenkouSpanB", PlotType = PlotType.Points, LineColor = "FFFF6666", Thickness = 2)]
public IndicatorDataSeries SenkouSpanBResult { get; set; }
[Output("KijunSen extra1", PlotType = PlotType.Points, LineColor = "green", Thickness = 2)]
public IndicatorDataSeries KijunSenExtra1Result { get; set; }
[Output("KijunSen extra2", PlotType = PlotType.Points, LineColor = "orange", Thickness = 2)]
public IndicatorDataSeries KijunSenExtra2Result { get; set; }
[Output("Tenkan +17", PlotType = PlotType.Points, LineColor = "yellow", Thickness = 2)]
public IndicatorDataSeries TenkanSen17Result { get; set; }
[Output("QualityLine", PlotType = PlotType.Points, LineColor = "Black", Thickness = 2)]
public IndicatorDataSeries QualityLineResult { get; set; }
[Output("DirectionLine", PlotType = PlotType.Points, LineColor = "Purple", Thickness = 2)]
public IndicatorDataSeries DirectionLineResult { get; set; }
double maxfast, minfast, maxmedium, minmedium, maxmedium1, minmedium1,
maxslow, minslow, maxslow1, minslow1, maxslow2, minslow2;
#endregion
#region Global Variables
private Bars mseries2;
private Bars mseries_mn;
private IchimokuKinkoHyo Ichimoku;
#endregion
protected override void Initialize()
{
// Initialize and create nested indicators
Ichimoku = Indicators.IchimokuKinkoHyo( TenkanSenPeriods, KijunSenPeriods, SenkouSpanBPeriods);
mseries2 = MarketData.GetBars(TimeFrame);
mseries_mn = MarketData.GetBars(TimeFrame.Monthly);
}
//END METHOD INITIALIZE
public override void Calculate(int index)
{
if ((index < QualityLinePeriod) || (index < DirectionLinePeriod))
{
return;
}
maxfast = Bars.HighPrices[index];
minfast = Bars.LowPrices[index];
maxmedium = Bars.HighPrices[index];
minmedium = Bars.LowPrices[index];
maxmedium1 = Bars.HighPrices[index];
minmedium1 = Bars.LowPrices[index];
maxslow = Bars.HighPrices[index];
minslow = Bars.LowPrices[index];
maxslow1 = Bars.HighPrices[index];
minslow1 = Bars.LowPrices[index];
maxslow2 = Bars.HighPrices[index];
minslow2 = Bars.LowPrices[index];
maxmedium1 = Bars.HighPrices[index];
minmedium1 = Bars.LowPrices[index];
for (int i = 0; i < SenkouSpanBPeriods; i++)
{
if (maxslow < Bars.HighPrices[index - i])
{
maxslow = Bars.HighPrices[index - i];
}
if (minslow > Bars.LowPrices[index - i])
{
minslow = Bars.LowPrices[index - i];
}
}
for (int i = 0; i < TenkanSen17Periods; i++)
{
if (maxfast < Bars.HighPrices[index - i])
{
maxfast = Bars.HighPrices[index - i];
}
if (minfast > Bars.LowPrices[index - i])
{
minfast = Bars.LowPrices[index - i];
}
}
for (int i = 0; i < QualityLinePeriod; i++)
{
if (maxmedium < Bars.HighPrices[index - i])
{
maxmedium = Bars.HighPrices[index - i];
}
if (minmedium > Bars.LowPrices[index - i])
{
minmedium = Bars.LowPrices[index - i];
}
}
for (int i = 0; i < DirectionLinePeriod; i++)
{
if (maxmedium1 < Bars.HighPrices[index - i])
{
maxmedium1 = Bars.HighPrices[index - i];
}
if (minmedium1 > Bars.LowPrices[index - i])
{
minmedium1 = Bars.LowPrices[index - i];
}
}
for (int i = 0; i < KijunSenExtra1Periods; i++)
{
if (maxslow1 < Bars.HighPrices[index - i])
{
maxslow1 = Bars.HighPrices[index - i];
}
if (minslow1 > Bars.LowPrices[index - i])
{
minslow1 = Bars.LowPrices[index - i];
}
}
for (int i = 0; i < KijunSenExtera2Periods; i++)
{
if (maxslow2 < Bars.HighPrices[index - i])
{
maxslow2 = Bars.HighPrices[index - i];
}
if (minslow2 > Bars.LowPrices[index - i])
{
minslow2 = Bars.LowPrices[index - i];
}
}
TenkanSen17Result[index + TenkanSen17Shift] = ((maxfast + minfast) / 2);
QualityLineResult[index + QualityLineShift] = ((maxmedium + minmedium) / 2);
DirectionLineResult[index + DirectionLineShift] = ((maxmedium1 + minmedium1) / 2);
KijunSenExtra1Result[index + KijunSenExtra1Shift] = ((maxslow1 + minslow1) / 2);
KijunSenExtra2Result[index + KijunSenExtra2Shift] = ((maxslow2 + minslow2) / 2);
TenkanSenResult[index] = Ichimoku.TenkanSen[index];
KijunSenResult[index] = Ichimoku.KijunSen[index];
ChikouSpanResult[index + ChikouSpanShift] = Bars.ClosePrices[index];
SenkouSpanAResult[index + KumoShift] = (TenkanSenResult[index] + KijunSenResult[index]) / 2;
SenkouSpanBResult[index + KumoShift] = ((maxslow + minslow) / 2);
}
//END METHOD CALCULATE
}
//END class DisplayDWMPipsonCharts
}
//END namespace cAlgo
ichimoku.trader
Joined on 27.03.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: IchimokuDots.algo
- Rating: 0
- Installs: 281
- Modified: 06/04/2024 13:23
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.