Category Trend  Published on 29/03/2020

SSL Channel

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


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];
        }
    }
}


DO
DontMatter

Joined on 15.11.2019

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: SSL Channel.algo
  • Rating: 5
  • Installs: 4681
Comments
Log in to add a comment.
No comments found.