ReferencePoints free

by user123456 in category Other at 16/09/2020
Description

This indicator was made by cysecsbin.01 , for any problem or bug, write on the telegram group

Join on t.me/cTraderCommunity

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 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 ReferencePoints : Indicator
    {
        [Parameter(DefaultValue = 0.25)]
        public double Step { get; set; }
        [Parameter(DefaultValue = 10)]
        public int Levels { get; set; }
        [Parameter(DefaultValue = 11)]
        public TimeFrame TF { get; set; }

        Bars Series;

        protected override void Initialize()
        {
            Series = MarketData.GetBars(TF);
            Step /= 100;
        }

        int LastBar = 0;
        public override void Calculate(int index)
        {
            int seriesIndex = Series.OpenTimes.GetIndexByTime(Bars[index].OpenTime);

            if (index <= LastBar)
                return;
            LastBar = index;

            int startIndex = Bars.OpenTimes.GetIndexByTime(Series[seriesIndex].OpenTime);
            int endIndex = index;

            double open = Series[seriesIndex].Open;

            for (int i = 0; i < Levels; ++i)
            {
                double levelUp = open + Step * i;
                double levelDown = open - Step * i;
                Chart.DrawTrendLine((Step * i) + " LevelUp " + seriesIndex, startIndex, levelUp, endIndex, levelUp, Color.Lime, 1, LineStyle.DotsRare);
                Chart.DrawTrendLine((Step * i) + " LevelDown " + seriesIndex, startIndex, levelDown, endIndex, levelDown, Color.Red, 1, LineStyle.DotsRare);

                if (i == 0)
                    continue;

                ChartText textUp = Chart.DrawText((Step * i) + " TextUp " + seriesIndex, (Step * i * 100).ToString(), endIndex, levelUp, Color.Lime);
                textUp.VerticalAlignment = VerticalAlignment.Top;
                textUp.HorizontalAlignment = HorizontalAlignment.Left;
                ChartText textDown = Chart.DrawText((Step * i) + " TextDown " + seriesIndex, (-Step * i * 100).ToString(), endIndex, levelDown, Color.Red);
                textDown.VerticalAlignment = VerticalAlignment.Bottom;
                textDown.HorizontalAlignment = HorizontalAlignment.Left;
            }
        }
    }
}
Comments
0