SSL Channel free

by DontMatter in category Trend at 15/03/2020
Description

Based on this one by cysecsbin.01.

Added Cloud colorization + adjustable MA type.

 

SSL Channel is based on an average of the highs and lows. It flips from green to red signifying a potential turn. 

 

If you like my work, feel free to spend me a Corona Beer :-)

Donate

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Cloud("SSLDown", "SSLUp")]
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class SSLChannel : Indicator
    {
        //////////////////////////////////////////////////////////////////////// PARAMETERS
        [Parameter("Length", DefaultValue = 10)]
        public int _length { get; set; }
        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType _MAType { get; set; }

        //////////////////////////////////////////////////////////////////////// OUTPUTS
        [Output("SSLDown", LineColor = "Red")]
        public IndicatorDataSeries _sslDown { get; set; }
        [Output("SSLUp", LineColor = "Green")]
        public IndicatorDataSeries _sslUp { get; set; }

        private MovingAverage _maHigh, _maLow;
        private IndicatorDataSeries _hlv;
        //////////////////////////////////////////////////////////////////////// INITIALIZE
        protected override void Initialize()
        {
            _maHigh = Indicators.MovingAverage(Bars.HighPrices, _length, _MAType);
            _maLow = Indicators.MovingAverage(Bars.LowPrices, _length, _MAType);
            _hlv = CreateDataSeries();
        }
        //////////////////////////////////////////////////////////////////////// CALCULATE
        public override void Calculate(int index)
        {
            _hlv[index] = Bars.ClosePrices[index] > _maHigh.Result[index] ? 1 : Bars.ClosePrices[index] < _maLow.Result[index] ? -1 : _hlv[index - 1];
            _sslDown[index] = _hlv[index] < 0 ? _maHigh.Result[index] : _maLow.Result[index];
            _sslUp[index] = _hlv[index] < 0 ? _maLow.Result[index] : _maHigh.Result[index];
        }
    }
}
Comments
5