Description
CCI Indicator in Histogram form with color coded once the there is enough MOMENTUM on the previous move, a very good trade entry confirmation.
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
[Levels(100, -100)]
public class CCI : Indicator
{
private CommodityChannelIndex cci;
private double g_icci_140;
private double g_icci_148;
[Parameter("CCI Period", DefaultValue = 50)]
public int CciPeriod { get; set; }
[Parameter("Momentum", DefaultValue = 40)]
public int Momentum { get; set; }
[Output("Gray", LineColor = "Gray", IsHistogram = true, Thickness = 1)]
public IndicatorDataSeries g_ibuf_164 { get; set; }
[Output("Blue", LineColor = "Blue", IsHistogram = true, Thickness = 4)]
public IndicatorDataSeries g_ibuf_168 { get; set; }
[Output("Red", LineColor = "Red", IsHistogram = true, Thickness = 4)]
public IndicatorDataSeries g_ibuf_176 { get; set; }
protected override void Initialize()
{
cci = Indicators.CommodityChannelIndex(CciPeriod);
}
public override void Calculate(int index)
{
g_icci_140 = cci.Result[index];
g_icci_148 = cci.Result[index - 1];
g_ibuf_164[index] = 0;
g_ibuf_168[index] = 0;
g_ibuf_176[index] = 0;
if ((g_icci_140 - g_icci_148) < (-Momentum))
g_ibuf_176[index] = g_icci_140;
else if ((g_icci_140 - g_icci_148) > (Momentum))
g_ibuf_168[index] = g_icci_140;
else
g_ibuf_164[index] = g_icci_140;
}
}
}
TR
traderfxmaster007
Joined on 09.07.2019
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: CCI Histogram.algo
- Rating: 0
- Installs: 1895
- Modified: 16/12/2021 20:38
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.