Category Trend  Published on 28/06/2019

ST Trend

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 a simple trend indicator, it uses a grid made of supertrends to determine the magnitude of the current retracement.

You have to experiment a lot with parameters, do it and you'll find lots of pretty things.

Supertrends NOT included

for any bug report or suggestion you want to make, comment below or join one of the groups listed above


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

namespace cAlgo
{
    [Indicator(IsOverlay = false, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class STTrendv2 : Indicator
    {
        [Parameter("Periods Top", DefaultValue = 200)]
        public int per1 { get; set; }
        [Parameter("Multiplier Top", DefaultValue = 2)]
        public double mul1 { get; set; }
        [Parameter("Periods Intermediate Up", DefaultValue = 200)]
        public int per2 { get; set; }
        [Parameter("Multiplier Intermediate Up", DefaultValue = 3)]
        public double mul2 { get; set; }
        [Parameter("Periods Intermediate Down", DefaultValue = 200)]
        public int per3 { get; set; }
        [Parameter("Multiplier Intermediate Down", DefaultValue = 4)]
        public double mul3 { get; set; }
        [Parameter("Periods Bottom", DefaultValue = 200)]
        public int per4 { get; set; }
        [Parameter("Multiplier Bottom", DefaultValue = 5)]
        public double mul4 { get; set; }

        [Parameter("Smoothing", DefaultValue = 24)]
        public int per { get; set; }

        private Ichitrend ichi;
        private SimpleMovingAverage sma;

        [Output("MA", PlotType = PlotType.Points, LineColor = "Green", Thickness = 3)]
        public IndicatorDataSeries Result { get; set; }

        private IndicatorDataSeries dati;

        protected override void Initialize()
        {
            IndicatorArea.DrawHorizontalLine("0", 0, Color.Gray);
            IndicatorArea.DrawHorizontalLine("1", 1, Color.Gray);
            IndicatorArea.DrawHorizontalLine("-1", -1, Color.Gray);
            dati = CreateDataSeries();
            ichi = Indicators.GetIndicator<Ichitrend>(per1, mul1, per2, mul2, per3, mul3, per4, mul4);
            sma = Indicators.SimpleMovingAverage(dati, per);
        }

        public override void Calculate(int index)
        {
            dati[index] = 0;

            double close = MarketSeries.Close[index];

            dati[index] += close > ichi.top[index] ? 1 : -1;
            dati[index] += close > ichi.int1[index] ? 1 : -1;
            dati[index] += close > ichi.int2[index] ? 1 : -1;
            dati[index] += close > ichi.bot[index] ? 1 : -1;

            Result[index] = sma.Result[index] / 4;
        }
    }
}


CY
cysecsbin.01

Joined on 10.11.2018 Blocked

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: STTrendv2.algo
  • Rating: 5
  • Installs: 1736
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
ES
esmail.kalim · 2 years ago

I tried to use your indicator to build a CBot due to used Ichitrend its impossible.

ichi = Indicators.GetIndicator<Ichitrend>(per1, mul1, per2, mul2, per3, mul3, per4, mul4);

How can I find that indicator?