Custom R numbers free

by yomm0401 in category Other at 29/05/2020
Description
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;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None, AutoRescale = false)]
    public class CustomRNumbers : Indicator
    {
        [Parameter(DefaultValue = 50)]
        public int StepPips { get; set; }

        [Parameter("Line Color", DefaultValue = "Blue")]
        public string lineColor { get; set; }

        [Parameter("Transparency", DefaultValue = 40, MinValue = 0, MaxValue = 255)]
        public int l_Transparency { get; set; }

        [Parameter("Linestyle", DefaultValue = "Solid")]
        public LineStyle LineStyle { get; set; }

        [Parameter("Thickness", DefaultValue = 1)]
        public int _tickness { get; set; }

        [Parameter("Extend line", DefaultValue = 0)]
        public int e_line { get; set; }

        public int FirstVisibleBarIndex { get; set; }

        public double max, min, step, start;
        public Color _Color;
        public byte _g, _b, _r;

        protected override void Initialize()
        {
            max = Bars.HighPrices.Maximum(Bars.HighPrices.Count);
            min = Bars.LowPrices.Minimum(Bars.LowPrices.Count);
            step = Symbol.PipSize * StepPips;
            start = Math.Floor(min / step) * step;
            _Color = Color.FromName(lineColor);
            _g = _Color.G;
            _b = _Color.B;
            _r = _Color.R;

        }

        public override void Calculate(int index)
        {

            for (double level = start; level <= max + step; level += step)
            {

                Chart.DrawTrendLine("Round Numbers" + level, FirstVisibleBarIndex, level, index + e_line, level, Color.FromArgb(l_Transparency, _r, _g, _b), _tickness, LineStyle);
            }

        }
    }
}
Comments
0