Warning! This section will be deprecated on February 1st 2025. Please move all your Indicators to the cTrader Store catalogue.
Description
This indicator employs a fast stochastic indicator, and the data source is cci value of the prices
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class STOCHcciIndicator : Indicator
{
[Output("STOCHcciIndicator",Color = Colors.Blue)]
public IndicatorDataSeries StochCCIv { get; set; }
[Output("Trigger",Color = Colors.Red)]
public IndicatorDataSeries Trigger { get; set; }
[Parameter(DefaultValue = 14, MinValue = 2)]
public int Period { get; set; }
[Parameter(DefaultValue = 5)]
public int PeriodK { get; set; }
[Parameter(DefaultValue = 3)]
public int Periodd { get; set; }
private CommodityChannelIndex cci;
private IndicatorDataSeries value1;
protected override void Initialize()
{ cci = Indicators.CommodityChannelIndex(Period);
value1 = CreateDataSeries();
}
public override void Calculate(int index)
{
double cciL = cci.Result[index];
double cciH = cci.Result[index];
double sum = 0.0;
for (int i = index - PeriodK + 1; i <= index; i++)
{
if(cciH<cci.Result[i]){cciH=cci.Result[i];}
if(cciL>cci.Result[i]){cciL=cci.Result[i];}
}
StochCCIv[index] = 100*((cci.Result[index] - cciL) / (cciH - cciL));
for (int i = index - Periodd + 1; i <= index; i++)
{
sum += StochCCIv[i];
}
Trigger[index] = sum/Periodd;
}
}
}
AS
ashish.sah.np
Joined on 19.12.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: STOCHcci Indicator.algo
- Rating: 0
- Installs: 753
- Modified: 21/12/2022 15:01
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.