Category Trend  Published on 11/07/2019

SSL

Description

Follow my cTrader Telegram group at https://t.me/cTraderCommunity; it's a new community but it will grow fast, plus everyone can talk about cTrader indicators and algorithm without restrictions, though it is not allowed to spam commercial indicators to sell them. There's also a Discord Server now @ https://discord.gg/5GAPMtp

This is the SSL indicator convertend from tradingview. It was a little request on my discord server, so here it is

For any bug report or suggestion, follow my telegram group or comment below


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SSL : Indicator
    {
        [Parameter("Length", DefaultValue = 10)]
        public int len { get; set; }

        [Output("SSLDown", LineColor = "Red")]
        public IndicatorDataSeries sslDown { get; set; }
        [Output("SSLUp", LineColor = "Green")]
        public IndicatorDataSeries sslUp { get; set; }

        private SimpleMovingAverage smaHigh, smaLow;
        private IndicatorDataSeries hlv;

        protected override void Initialize()
        {
            smaHigh = Indicators.SimpleMovingAverage(MarketSeries.High, len);
            smaLow = Indicators.SimpleMovingAverage(MarketSeries.Low, len);
            hlv = CreateDataSeries();
        }

        public override void Calculate(int index)
        {
            hlv[index] = MarketSeries.Close[index] > smaHigh.Result[index] ? 1 : MarketSeries.Close[index] < smaLow.Result[index] ? -1 : hlv[index - 1];
            sslDown[index] = hlv[index] < 0 ? smaHigh.Result[index] : smaLow.Result[index];
            sslUp[index] = hlv[index] < 0 ? smaLow.Result[index] : smaHigh.Result[index];
        }
    }
}


CY
cysecsbin.01

Joined on 10.11.2018 Blocked

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: SSL.algo
  • Rating: 5
  • Installs: 2689
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
CI
ciripa · 4 years ago

Thank you very much. Well done.

AL
alexsanramon · 5 years ago

Thank you