Description
This is the Chande Kroll Stop indicator for cTrader, you can use it for setting your orders stop.
Github:
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Chande Kroll Volatility Stop is a technical analysis indicator created by Tushar Chande and Stanley Kroll suggested the Chande Kroll Stop indicator in their book “The New Technical Trader”.
// It is a trend-following indicator, detecting stops by calculating the average true range of the volatility of the recent market.
//
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ChandeKrollStop : Indicator
{
private AverageTrueRange _atr;
private IndicatorDataSeries _preliminaryHighStop;
private IndicatorDataSeries _preliminaryLowStop;
[Parameter("ATR Periods", DefaultValue = 10, MinValue = 1)]
public int AtrPeriods { get; set; }
[Parameter("ATR MA Type", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType AtrMaType { get; set; }
[Parameter("Stop Periods", DefaultValue = 9, MinValue = 1)]
public int StopPeriods { get; set; }
[Parameter("Multiplier ", DefaultValue = 1, MinValue = 1)]
public int Multiplier { get; set; }
[Output("Short Stop", LineColor = "Red", PlotType = PlotType.Line)]
public IndicatorDataSeries ShortStop { get; set; }
[Output("Long Stop", LineColor = "Green", PlotType = PlotType.Line)]
public IndicatorDataSeries LongStop { get; set; }
protected override void Initialize()
{
_atr = Indicators.AverageTrueRange(AtrPeriods, AtrMaType);
_preliminaryHighStop = CreateDataSeries();
_preliminaryLowStop = CreateDataSeries();
}
public override void Calculate(int index)
{
var atrMultiplied = _atr.Result[index] * Multiplier;
_preliminaryHighStop[index] = Bars.HighPrices.Maximum(AtrPeriods) - atrMultiplied;
_preliminaryLowStop[index] = Bars.LowPrices.Minimum(AtrPeriods) + atrMultiplied;
LongStop[index] = _preliminaryLowStop.Minimum(StopPeriods);
ShortStop[index] = _preliminaryHighStop.Maximum(StopPeriods);
}
}
}
Spotware
Joined on 23.09.2013
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Chande Kroll Stop.algo
- Rating: 5
- Installs: 1318
- Modified: 13/10/2021 09:55
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.